From 964505d268ef785b9d62b958806adc8f2f11a374 Mon Sep 17 00:00:00 2001 From: Keang Date: Fri, 4 Nov 2016 10:34:44 +0800 Subject: [PATCH 1/2] Update cancellation policy naming --- lib/concierge/roomorama/cancellation_policy.rb | 9 +++++++++ lib/concierge/suppliers/atleisure/mapper.rb | 2 +- .../suppliers/avantio/mappers/roomorama_property.rb | 2 +- .../suppliers/ciirus/mappers/roomorama_property.rb | 2 +- lib/concierge/suppliers/kigo/mappers/property.rb | 2 +- .../suppliers/poplidays/mappers/roomorama_property.rb | 2 +- .../rentals_united/mappers/roomorama_property.rb | 2 +- .../suppliers/saw/mappers/roomorama_property.rb | 2 +- lib/concierge/suppliers/waytostay/properties.rb | 2 +- .../waytostay/properties/001.roomorama-attributes.json | 2 +- .../waytostay/properties/002.roomorama-attributes.json | 2 +- .../properties/015868.roomorama-attributes.json | 2 +- spec/lib/concierge/roomorama/diff_spec.rb | 4 ++-- spec/lib/concierge/roomorama/property_spec.rb | 4 ++-- spec/lib/concierge/suppliers/atleisure/mapper_spec.rb | 2 +- .../suppliers/avantio/mappers/roomorama_property_spec.rb | 2 +- .../suppliers/ciirus/mappers/roomorama_property_spec.rb | 2 +- .../concierge/suppliers/kigo/mappers/property_spec.rb | 2 +- .../poplidays/mappers/roomorama_property_spec.rb | 2 +- .../rentals_united/mappers/roomorama_property_spec.rb | 2 +- 20 files changed, 30 insertions(+), 21 deletions(-) create mode 100644 lib/concierge/roomorama/cancellation_policy.rb diff --git a/lib/concierge/roomorama/cancellation_policy.rb b/lib/concierge/roomorama/cancellation_policy.rb new file mode 100644 index 000000000..2aa0a29d5 --- /dev/null +++ b/lib/concierge/roomorama/cancellation_policy.rb @@ -0,0 +1,9 @@ +module Roomorama + module CancellationPolicy + FLEXIBLE = 'flexible'.freeze + MODERATE = 'moderate'.freeze + FIRM = 'firm'.freeze + STRICT = 'strict'.freeze + SUPER_STRICT = 'super_strict'.freeze + end +end diff --git a/lib/concierge/suppliers/atleisure/mapper.rb b/lib/concierge/suppliers/atleisure/mapper.rb index 80b0171cf..f15c968f1 100644 --- a/lib/concierge/suppliers/atleisure/mapper.rb +++ b/lib/concierge/suppliers/atleisure/mapper.rb @@ -10,7 +10,7 @@ module AtLeisure # * +meta_data+ - hash based AtLeisure payload # class Mapper - CANCELLATION_POLICY = 'super_elite' + CANCELLATION_POLICY = Roomorama::CancellationPolicy::SUPER_STRICT CODES = { property_type: 10, diff --git a/lib/concierge/suppliers/avantio/mappers/roomorama_property.rb b/lib/concierge/suppliers/avantio/mappers/roomorama_property.rb index 02aa007c2..0d09e88b3 100644 --- a/lib/concierge/suppliers/avantio/mappers/roomorama_property.rb +++ b/lib/concierge/suppliers/avantio/mappers/roomorama_property.rb @@ -5,7 +5,7 @@ module Mappers # This class is responsible for building a +Roomorama::Property+ object # from data getting from Avantio. class RoomoramaProperty - CANCELLATION_POLICY = 'super_elite' + CANCELLATION_POLICY = Roomorama::CancellationPolicy::SUPER_STRICT PROPERTY_TYPES = Concierge::SafeAccessHash.new({ 1 => {type: 'apartment'}, # Apartment diff --git a/lib/concierge/suppliers/ciirus/mappers/roomorama_property.rb b/lib/concierge/suppliers/ciirus/mappers/roomorama_property.rb index d7fd9cb12..36c909b55 100644 --- a/lib/concierge/suppliers/ciirus/mappers/roomorama_property.rb +++ b/lib/concierge/suppliers/ciirus/mappers/roomorama_property.rb @@ -5,7 +5,7 @@ module Mappers # This class is responsible for building a +Roomorama::Property+ object # from data getting from Ciirus API. class RoomoramaProperty - CANCELLATION_POLICY = 'super_elite' + CANCELLATION_POLICY = Roomorama::CancellationPolicy::SUPER_STRICT # Until we hear from ciirus on how to determine this field, it will be.. unknown SECURITY_DEPOSIT_TYPE = 'unknown' diff --git a/lib/concierge/suppliers/kigo/mappers/property.rb b/lib/concierge/suppliers/kigo/mappers/property.rb index 11738c347..d7503ab41 100644 --- a/lib/concierge/suppliers/kigo/mappers/property.rb +++ b/lib/concierge/suppliers/kigo/mappers/property.rb @@ -14,7 +14,7 @@ module Kigo::Mappers # class Property - CANCELLATION_POLICY = 'super_elite' + CANCELLATION_POLICY = Roomorama::CancellationPolicy::SUPER_STRICT attr_reader :property, :payload, :references, :pricing, :resolver diff --git a/lib/concierge/suppliers/poplidays/mappers/roomorama_property.rb b/lib/concierge/suppliers/poplidays/mappers/roomorama_property.rb index c32d9455b..7ef88b57d 100644 --- a/lib/concierge/suppliers/poplidays/mappers/roomorama_property.rb +++ b/lib/concierge/suppliers/poplidays/mappers/roomorama_property.rb @@ -6,7 +6,7 @@ module Mappers # from data getting from Poplidays API. class RoomoramaProperty # NOTE: actually Poplidays API doesn't support cancellation - CANCELLATION_POLICY = 'super_elite' + CANCELLATION_POLICY = Roomorama::CancellationPolicy::SUPER_STRICT # Apparently Poplidays does not have the "security deposit method", # and they ask the guest to figure out directly with the host. diff --git a/lib/concierge/suppliers/rentals_united/mappers/roomorama_property.rb b/lib/concierge/suppliers/rentals_united/mappers/roomorama_property.rb index 45231326c..318088be7 100644 --- a/lib/concierge/suppliers/rentals_united/mappers/roomorama_property.rb +++ b/lib/concierge/suppliers/rentals_united/mappers/roomorama_property.rb @@ -7,7 +7,7 @@ class RoomoramaProperty attr_reader :ru_property, :location, :owner, :seasons EN_DESCRIPTION_LANG_CODE = "1" - CANCELLATION_POLICY = "super_elite" + CANCELLATION_POLICY = Roomorama::CancellationPolicy::SUPER_STRICT DEFAULT_PROPERTY_RATE = "9999" MINIMUM_STAY = 1 SURFACE_UNIT = "metric" diff --git a/lib/concierge/suppliers/saw/mappers/roomorama_property.rb b/lib/concierge/suppliers/saw/mappers/roomorama_property.rb index 94151c1cb..f54870583 100644 --- a/lib/concierge/suppliers/saw/mappers/roomorama_property.rb +++ b/lib/concierge/suppliers/saw/mappers/roomorama_property.rb @@ -6,7 +6,7 @@ module Mappers # Object initialization includes mapping of property attributes, rates, # amenitites, images, units. class RoomoramaProperty - CANCELLATION_POLICY = 'moderate' + CANCELLATION_POLICY = Roomorama::CancellationPolicy::MODERATE # Bulds Roomorama::Property object # diff --git a/lib/concierge/suppliers/waytostay/properties.rb b/lib/concierge/suppliers/waytostay/properties.rb index 3644e31e2..323577ab1 100644 --- a/lib/concierge/suppliers/waytostay/properties.rb +++ b/lib/concierge/suppliers/waytostay/properties.rb @@ -199,7 +199,7 @@ def property_attributes_from(response) attr.merge!({ surface_unit: "metric", default_to_available: true, - cancellation_policy: "strict", + cancellation_policy: Roomorama::CancellationPolicy::FIRM, instant_booking: true }) attr.merge! parse_floors(response) diff --git a/spec/fixtures/waytostay/properties/001.roomorama-attributes.json b/spec/fixtures/waytostay/properties/001.roomorama-attributes.json index aabd32717..6cb61ae5b 100644 --- a/spec/fixtures/waytostay/properties/001.roomorama-attributes.json +++ b/spec/fixtures/waytostay/properties/001.roomorama-attributes.json @@ -32,7 +32,7 @@ "check_out_time": "11:00:00", "currency": "EUR", "default_to_available": true, - "cancellation_policy": "strict", + "cancellation_policy": "firm", "services_cleaning": true, "services_cleaning_rate": 75, "services_cleaning_required": true, diff --git a/spec/fixtures/waytostay/properties/002.roomorama-attributes.json b/spec/fixtures/waytostay/properties/002.roomorama-attributes.json index 6377c08c1..2ca2240cd 100644 --- a/spec/fixtures/waytostay/properties/002.roomorama-attributes.json +++ b/spec/fixtures/waytostay/properties/002.roomorama-attributes.json @@ -32,7 +32,7 @@ "check_out_time": "11:00:00", "currency": "EUR", "default_to_available": true, - "cancellation_policy": "strict", + "cancellation_policy": "firm", "services_cleaning": true, "services_cleaning_rate": 75, "services_cleaning_required": true, diff --git a/spec/fixtures/waytostay/properties/015868.roomorama-attributes.json b/spec/fixtures/waytostay/properties/015868.roomorama-attributes.json index eabeee83d..aa3380d03 100644 --- a/spec/fixtures/waytostay/properties/015868.roomorama-attributes.json +++ b/spec/fixtures/waytostay/properties/015868.roomorama-attributes.json @@ -42,7 +42,7 @@ "security_deposit_currency": "EUR", "security_deposit_type": "cash", "default_to_available": true, - "cancellation_policy": "strict", + "cancellation_policy": "firm", "instant_booking": true, "description_append": "License number: HUTB-012425 68", "translations": { diff --git a/spec/lib/concierge/roomorama/diff_spec.rb b/spec/lib/concierge/roomorama/diff_spec.rb index 35ef6058c..85ffbeca6 100644 --- a/spec/lib/concierge/roomorama/diff_spec.rb +++ b/spec/lib/concierge/roomorama/diff_spec.rb @@ -12,10 +12,10 @@ it "is able to set and retrieve property attributes" do subject.title = "Beautiful Apartment in Paris" - subject.cancellation_policy = "elite" + subject.cancellation_policy = Roomorama::CancellationPolicy::STRICT expect(subject.title).to eq "Beautiful Apartment in Paris" - expect(subject.cancellation_policy).to eq "elite" + expect(subject.cancellation_policy).to eq Roomorama::CancellationPolicy::STRICT end it "is nil for attributes not set" do diff --git a/spec/lib/concierge/roomorama/property_spec.rb b/spec/lib/concierge/roomorama/property_spec.rb index 7dfca57ca..b83732d15 100644 --- a/spec/lib/concierge/roomorama/property_spec.rb +++ b/spec/lib/concierge/roomorama/property_spec.rb @@ -12,10 +12,10 @@ it "is able to set and retrieve property attributes" do subject.title = "Beautiful Apartment in Paris" - subject.cancellation_policy = "elite" + subject.cancellation_policy = Roomorama::CancellationPolicy::STRICT expect(subject.title).to eq "Beautiful Apartment in Paris" - expect(subject.cancellation_policy).to eq "elite" + expect(subject.cancellation_policy).to eq Roomorama::CancellationPolicy::STRICT end it "is nil for attributes not set" do diff --git a/spec/lib/concierge/suppliers/atleisure/mapper_spec.rb b/spec/lib/concierge/suppliers/atleisure/mapper_spec.rb index 999383076..9f85c6248 100644 --- a/spec/lib/concierge/suppliers/atleisure/mapper_spec.rb +++ b/spec/lib/concierge/suppliers/atleisure/mapper_spec.rb @@ -128,7 +128,7 @@ expect(property.max_guests).to eq 8 expect(property.pets_allowed).to eq true expect(property.currency).to eq 'EUR' - expect(property.cancellation_policy).to eq 'super_elite' + expect(property.cancellation_policy).to eq 'super_strict' expect(property.default_to_available).to eq false expect(property.country_code).to eq 'BE' expect(property.city).to eq 'Malmedy' diff --git a/spec/lib/concierge/suppliers/avantio/mappers/roomorama_property_spec.rb b/spec/lib/concierge/suppliers/avantio/mappers/roomorama_property_spec.rb index 348513c98..d5f2e2165 100644 --- a/spec/lib/concierge/suppliers/avantio/mappers/roomorama_property_spec.rb +++ b/spec/lib/concierge/suppliers/avantio/mappers/roomorama_property_spec.rb @@ -52,7 +52,7 @@ expect(property.surface_unit).to be_nil expect(property.pets_allowed).to be true expect(property.currency).to eq('EUR') - expect(property.cancellation_policy).to eq('super_elite') + expect(property.cancellation_policy).to eq('super_strict') expect(property.security_deposit_amount).to eq(1000.0) expect(property.security_deposit_type).to eq('cash') expect(property.security_deposit_currency_code).to eq('EUR') diff --git a/spec/lib/concierge/suppliers/ciirus/mappers/roomorama_property_spec.rb b/spec/lib/concierge/suppliers/ciirus/mappers/roomorama_property_spec.rb index 2ca9a71b9..b1c4b9fc8 100644 --- a/spec/lib/concierge/suppliers/ciirus/mappers/roomorama_property_spec.rb +++ b/spec/lib/concierge/suppliers/ciirus/mappers/roomorama_property_spec.rb @@ -98,7 +98,7 @@ expect(roomorama_property.amenities).to eq(amenities) expect(roomorama_property.pets_allowed).to be(true) expect(roomorama_property.currency).to eq('USD') - expect(roomorama_property.cancellation_policy).to eq('super_elite') + expect(roomorama_property.cancellation_policy).to eq('super_strict') expect(roomorama_property.images.length).to eq(1) image = roomorama_property.images.first diff --git a/spec/lib/concierge/suppliers/kigo/mappers/property_spec.rb b/spec/lib/concierge/suppliers/kigo/mappers/property_spec.rb index b2093e84b..e7f61a5bb 100644 --- a/spec/lib/concierge/suppliers/kigo/mappers/property_spec.rb +++ b/spec/lib/concierge/suppliers/kigo/mappers/property_spec.rb @@ -151,7 +151,7 @@ expect(property.floor).to eq 3 expect(property.pets_allowed).to eq true expect(property.smoking_allowed).to eq false - expect(property.cancellation_policy).to eq 'super_elite' + expect(property.cancellation_policy).to eq 'super_strict' expect(property.default_to_available).to eq true expect(property.check_in_time).to eq '15:00' expect(property.check_out_time).to eq '10:00' diff --git a/spec/lib/concierge/suppliers/poplidays/mappers/roomorama_property_spec.rb b/spec/lib/concierge/suppliers/poplidays/mappers/roomorama_property_spec.rb index 47c49c74e..151e8ad86 100644 --- a/spec/lib/concierge/suppliers/poplidays/mappers/roomorama_property_spec.rb +++ b/spec/lib/concierge/suppliers/poplidays/mappers/roomorama_property_spec.rb @@ -125,7 +125,7 @@ expect(roomorama_property.currency).to eq('EUR') expect(roomorama_property.surface).to eq(45) expect(roomorama_property.surface_unit).to eq('metric') - expect(roomorama_property.cancellation_policy).to eq('super_elite') + expect(roomorama_property.cancellation_policy).to eq('super_strict') expect(roomorama_property.security_deposit_amount).to eq(500.0) expect(roomorama_property.security_deposit_currency_code).to eq('EUR') expect(roomorama_property.security_deposit_type).to eq('unknown') diff --git a/spec/lib/concierge/suppliers/rentals_united/mappers/roomorama_property_spec.rb b/spec/lib/concierge/suppliers/rentals_united/mappers/roomorama_property_spec.rb index b6574641c..911215b90 100644 --- a/spec/lib/concierge/suppliers/rentals_united/mappers/roomorama_property_spec.rb +++ b/spec/lib/concierge/suppliers/rentals_united/mappers/roomorama_property_spec.rb @@ -164,7 +164,7 @@ end it "sets cancellation_policy to the property" do - expect(property.cancellation_policy).to eq("super_elite") + expect(property.cancellation_policy).to eq("super_strict") end it "sets default_to_available flag to false" do From 9a70c3ae079567ac488966b731f15cead5796f50 Mon Sep 17 00:00:00 2001 From: Keang Date: Tue, 8 Nov 2016 10:52:56 +0800 Subject: [PATCH 2/2] Bump version 0.13.1 --- CHANGELOG.md | 4 ++++ lib/concierge/version.rb | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0a28c219d..2ca58802b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,10 @@ 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.13.1] - 2016-11-08 +## Changed +- Cancellation policies naming + ## [0.13.0] - 2016-11-02 ### Added - Avantio integrations: quote, book, cancel and synchronisation diff --git a/lib/concierge/version.rb b/lib/concierge/version.rb index 60c3a7f39..9862d30a8 100644 --- a/lib/concierge/version.rb +++ b/lib/concierge/version.rb @@ -1,3 +1,3 @@ module Concierge - VERSION = "0.13.0" + VERSION = "0.13.1" end