Skip to content

Commit

Permalink
Merge pull request #377 from roomorama/release/0.11.1
Browse files Browse the repository at this point in the history
Release/0.11.1
  • Loading branch information
keang authored Sep 22, 2016
2 parents 65fcc0f + 0638ae5 commit 82b47c0
Show file tree
Hide file tree
Showing 5 changed files with 39 additions and 1 deletion.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,13 @@ This file summarises the most important changes that went live on each release
of Concierge. Please check the Wiki entry on the release process to understand
how this file is formatted and how the process works.

## [0.11.1] - 2016-09-22
### Added
- Add `rake hosts:create` to, well, create hosts

### Changed
- `Workers::CalendarSynchronisation` doesn't run operation for empty calendar

## [0.11.0] - 2016-09-21
### Added
- `ZendeskNotify` client with ticket creation on cancellation of bookings from Poplidays and AtLeisure
Expand Down
2 changes: 2 additions & 0 deletions apps/workers/calendar_synchronisation.rb
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,8 @@ def process(calendar)
# will not be recognised.)
return unless synchronised?(calendar.identifier)

return if calendar.empty?

calendar.validate!
update_counters(calendar)
operation = Roomorama::Client::Operations.update_calendar(calendar)
Expand Down
2 changes: 1 addition & 1 deletion lib/concierge/version.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
module Concierge
VERSION = "0.11.0"
VERSION = "0.11.1"
end
20 changes: 20 additions & 0 deletions lib/tasks/hosts.rake
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,26 @@ class HostCreationError < RuntimeError
end

namespace :hosts do

desc "Convenience task to create a new host"
task :create, [:supplier_name,
:identifier,
:username,
:access_token,
:fee_percentage] => :environment do |task, args|
config_path = Hanami.root.join("config", "suppliers.yml").to_s
Concierge::Flows::HostCreation.new(
supplier: SupplierRepository.named(args[:supplier_name]),
identifier: args[:identifier],
username: args[:username],
access_token: args[:access_token],
fee_percentage: args[:fee_percentage],
config_path: config_path
).perform.tap do |result|
raise HostCreationError.new(result.error.code) unless result.success?
end
end

desc "Updates background worker definitions for all hosts"
task update_worker_definitions: :environment do
path = Hanami.root.join("config", "suppliers.yml").to_s
Expand Down
9 changes: 9 additions & 0 deletions spec/workers/calendar_synchronisation_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@
end
}

let(:empty_calendar) { Roomorama::Calendar.new("prop1") }

subject { described_class.new(host) }

describe "#start" do
Expand All @@ -39,6 +41,13 @@
expect(operation.calendar).to eq calendar
end

it "does not run any operation for empty calendar" do
expect(subject).to_not receive(:run_operation)

create_property(identifier: "prop1", host_id: host.id)
subject.start("prop1") { Result.new(empty_calendar) }
end

context "error handling" do
it "announces an error if the calendar returned does not pass validations" do
calendar.entries.first.date = nil
Expand Down

0 comments on commit 82b47c0

Please sign in to comment.