roomorama / concierge

Roomorama supplier integrations - webhook providers and property synchronisation
https://concierge-web.roomorama.com
3 stars 0 forks source link

Add property push flow #606

Closed keang closed 7 years ago

keang commented 7 years ago

Concierge can republish properties to roomorama on-demand, avoiding refetching from suppliers. This speeds up the process and allows an easy interface for internal Roomorama team to refresh stale data that happens for any reason.

keang commented 7 years ago

Tested on staging console:

2.3.1 :001 > host = HostRepository.find 108
 => #<Host:0x0016893d0 @id=108 @supplier_id=13 @identifier="428403" @username="supplier_rentals_united_sandbox" @access_token="4wA0DsfkrQrTgl2gP3IRpueIOqRZS0UWYyJUdUiGkk" @fee_percentage=0.0 @created_at=2016-10-03 08:32:50 +0000 @updated_at=2017-02-02 08:57:12 +0000 @payment_terms=nil @email=nil @name=nil @phone=nil> 
2.3.1 :002 > w= Concierge::Flows::PropertyPush.new(host)
 => #<Concierge::Flows::PropertyPush:0x000000015d6de8 @host=#<Host:0x0016893d0 @id=108 @supplier_id=13 @identifier="428403" @username="supplier_rentals_united_sandbox" @access_token="4wA0DsfkrQrTgl2gP3IRpueIOqRZS0UWYyJUdUiGkk" @fee_percentage=0.0 @created_at=2016-10-03 08:32:50 +0000 @updated_at=2017-02-02 08:57:12 +0000 @payment_terms=nil @email=nil @name=nil @phone=nil>> 
2.3.1 :003 > w.call
 => [#<Result:0x000000012de5f0 @result=true>, #<Result:0x00000000f5adc0 @result=true>] 

Publish api is called:

» 2 Feb 2017 17:01:38.425 { "method": "POST", "path": "/v1.0/host/publish", "format": "json", "controller": "api/v1/host/publish", "action": "create", "status": 201, "duration": 192.723064, "view": 0.36, "db": 142.44, "data": null, "params": { "identifier": "599583", "type": "apartment", "title": "Test Property Edited", "description": "Awesome <b>Test Property</b>\nComposition: kitchen, 3x bedroom, 2x bathroom, 2x WC\nAmenities: 2x bed linen & towels, terrace, air conditioning, heating, swimming pool, wheelchair access possible, free wireless internet, free cot on request, braille elevator, elevator, smoking allowed, free parking on the street, iron & ironing board, double bed, tv, chest of drawers, bidet, toilet, mirror\n\ntest", "description_append": "* Late arrival fees:\n- 17:00 - 23:59 : 50.0 USD", "translations": { "es": { "description_append": "* Penalización por retraso en la llegada:\n- 17:00 - 23:59 : 50.0 USD" }, "de": { "description_append": "* Gebühren für späte Ankunft:\n- 17:00 - 23:59 : 50.0 USD" }, "zh": { "description_append": "* 晚到费用:\n- 17:00 - 23:59 : 50.0 USD" } }, "address": "115 Amoy Street", "postal_code": "069935", "city": "Singapore", "country_code": "SG", "lat": 1.2820967, "lng": 103.8480255, "number_of_bedrooms": 4, "number_of_bathrooms": 2, "floor": -1, "number_of_double_beds": 1, "number_of_single_beds": 1, "surface": 100, "surface_unit": "metric", "amenities": "bed_linen_and_towels,airconditioning,pool,wheelchairaccess,elevator,parking", "max_guests": 3, "minimum_stay": 1, "multi_unit": false, "smoking_allowed": true, "pets_allowed": false, "check_in_instructions": "Landlord: Developers Bridge Rentals\nEmail: developers@bridgerentals.com\nPhone: +6581872129\nDaysBeforeArrival: 2\nHowToArrive: Just knock and say your name.", "check_in_time": "17:00", "check_out_time": "11:00", "currency": "USD", "nightly_rate": 90, "weekly_rate": 630, "monthly_rate": 2700, "security_deposit_amount": 50, "security_deposit_type": "cash", "security_deposit_currency_code": "USD", "default_to_available": false, "cancellation_policy": "super_strict", "services_cleaning": false, "owner_name": "Developers Bridge Rentals", "owner_email": "developers@bridgerentals.com", "owner_phone_number": "+6581872129", "instant_booking": true, "images": [ { "identifier": "a22bf853b21322bac25d21fc3e63f161", "url": "https://dwe6atvmvow8k.cloudfront.net/ru/428403/599583/636106442476647843.jpg", "caption": "Interior" }, { "identifier": "deadf36c4b11bcff3a6d73fabd5081d0", "url": "https://dwe6atvmvow8k.cloudfront.net/ru/428403/599583/636106442484759603.jpg", "caption": "Main image" }, { "identifier": "aa9de20e53b69a2a5517b9f9e68f9b94", "url": "https://dwe6atvmvow8k.cloudfront.net/ru/428403/599583/636106444582756657.jpg", "caption": "Interior" }, { "identifier": "b41d6f7721541dfdf6752abb5aa615ef", "url": "https://dwe6atvmvow8k.cloudfront.net/ru/428403/599583/636106444589308404.jpg", "caption": "Interior" }, { "identifier": "f395be4d16de1444fc2c98868cd9db90", "url": "https://dwe6atvmvow8k.cloudfront.net/ru/428403/599583/636106444597264468.jpg", "caption": "Interior" }, { "identifier": "a22d6b3b266c170dfa33e788a8f28d71", "url": "https://dwe6atvmvow8k.cloudfront.net/ru/428403/599583/636106444605376226.jpg", "caption": "Interior" }, { "identifier": "13d59bfed64931752dd46a61b48b2eaa", "url": "https://dwe6atvmvow8k.cloudfront.net/ru/428403/599583/636106444612707985.jpg", "caption": "Interior" }, { "identifier": "a3ed73995eb3da1676ad8deec35fd2fd", "url": "https://dwe6atvmvow8k.cloudfront.net/ru/428403/599583/636106444623003759.jpg", "caption": "Interior" }, { "identifier": "621b35121a051d9b22774ef0ca035e51", "url": "https://dwe6atvmvow8k.cloudfront.net/ru/428403/599583/636135117358183562.jpg", "caption": "Interior" } ], "format": "json", "action": "create", "alias": "current", "controller": "api/v1/host/publish", "publish": { "identifier": "599583", "type": "apartment", "title": "Test Property Edited", "description": "Awesome <b>Test Property</b>\nComposition: kitchen, 3x bedroom, 2x bathroom, 2x WC\nAmenities: 2x bed linen & towels, terrace, air conditioning, heating, swimming pool, wheelchair access possible, free wireless internet, free cot on request, braille elevator, elevator, smoking allowed, free parking on the street, iron & ironing board, double bed, tv, chest of drawers, bidet, toilet, mirror\n\ntest", "description_append": "* Late arrival fees:\n- 17:00 - 23:59 : 50.0 USD", "translations": { "es": { "description_append": "* Penalización por retraso en la llegada:\n- 17:00 - 23:59 : 50.0 USD" }, "de": { "description_append": "* Gebühren für späte Ankunft:\n- 17:00 - 23:59 : 50.0 USD" }, "zh": { "description_append": "* 晚到费用:\n- 17:00 - 23:59 : 50.0 USD" } }, "address": "115 Amoy Street", "postal_code": "069935", "city": "Singapore", "country_code": "SG", "lat": 1.2820967, "lng": 103.8480255, "number_of_bedrooms": 4, "number_of_bathrooms": 2, "floor": -1, "number_of_double_beds": 1, "number_of_single_beds": 1, "surface": 100, "surface_unit": "metric", "amenities": "bed_linen_and_towels,airconditioning,pool,wheelchairaccess,elevator,parking", "max_guests": 3, "minimum_stay": 1, "multi_unit": false, "smoking_allowed": true, "pets_allowed": false, "check_in_instructions": "Landlord: Developers Bridge Rentals\nEmail: developers@bridgerentals.com\nPhone: +6581872129\nDaysBeforeArrival: 2\nHowToArrive: Just knock and say your name.", "check_in_time": "17:00", "check_out_time": "11:00", "currency": "USD", "nightly_rate": 90, "weekly_rate": 630, "monthly_rate": 2700, "security_deposit_amount": 50, "security_deposit_type": "cash", "security_deposit_currency_code": "USD", "default_to_available": false, "cancellation_policy": "super_strict", "services_cleaning": false, "owner_name": "Developers Bridge Rentals", "owner_email": "developers@bridgerentals.com", "owner_phone_number": "+6581872129", "instant_booking": true, "images": [ { "identifier": "a22bf853b21322bac25d21fc3e63f161", "url": "https://dwe6atvmvow8k.cloudfront.net/ru/428403/599583/636106442476647843.jpg", "caption": "Interior" }, { "identifier": "deadf36c4b11bcff3a6d73fabd5081d0", "url": "https://dwe6atvmvow8k.cloudfront.net/ru/428403/599583/636106442484759603.jpg", "caption": "Main image" }, { "identifier": "aa9de20e53b69a2a5517b9f9e68f9b94", "url": "https://dwe6atvmvow8k.cloudfront.net/ru/428403/599583/636106444582756657.jpg", "caption": "Interior" }, { "identifier": "b41d6f7721541dfdf6752abb5aa615ef", "url": "https://dwe6atvmvow8k.cloudfront.net/ru/428403/599583/636106444589308404.jpg", "caption": "Interior" }, { "identifier": "f395be4d16de1444fc2c98868cd9db90", "url": "https://dwe6atvmvow8k.cloudfront.net/ru/428403/599583/636106444597264468.jpg", "caption": "Interior" }, { "identifier": "a22d6b3b266c170dfa33e788a8f28d71", "url": "https://dwe6atvmvow8k.cloudfront.net/ru/428403/599583/636106444605376226.jpg", "caption": "Interior" }, { "identifier": "13d59bfed64931752dd46a61b48b2eaa", "url": "https://dwe6atvmvow8k.cloudfront.net/ru/428403/599583/636106444612707985.jpg", "caption": "Interior" }, { "identifier": "a3ed73995eb3da1676ad8deec35fd2fd", "url": "https://dwe6atvmvow8k.cloudfront.net/ru/428403/599583/636106444623003759.jpg", "caption": "Interior" }, { "identifier": "621b35121a051d9b22774ef0ca035e51", "url": "https://dwe6atvmvow8k.cloudfront.net/ru/428403/599583/636135117358183562.jpg", "caption": "Interior" } ] } }, "timestamp": "2017-02-02T09:01:37+00:00", "user": "supplier_rentals_united_sandbox" }
» 2 Feb 2017 17:01:38.481 { "method": "POST", "path": "/v1.0/host/publish", "format": "json", "controller": "api/v1/host/publish", "action": "create", "status": 201, "duration": 83.07450399999999, "view": 0.32, "db": 45.8, "data": null, "params": { "identifier": "599584", "type": "apartment", "title": "Test Apartment", "description": "Composition: kitchen, bedroom, bathroom, WC\nAmenities: air conditioning, smoking allowed", "address": "115 Amoy street", "postal_code": "069935", "city": "Singapore", "country_code": "SG", "lat": 1.2820967, "lng": 103.8480255, "number_of_bedrooms": 1, "number_of_bathrooms": 1, "floor": -1, "surface": 100, "surface_unit": "metric", "amenities": "airconditioning", "max_guests": 5, "minimum_stay": 1, "multi_unit": false, "smoking_allowed": true, "pets_allowed": false, "check_in_instructions": "Landlord: Developers Bridge Rentals\nEmail: developers@bridgerentals.com\nPhone: +6581872129\nDaysBeforeArrival: 0", "check_in_time": "17:00", "check_out_time": "11:00", "currency": "USD", "nightly_rate": 80, "weekly_rate": 560, "monthly_rate": 2400, "security_deposit_amount": 80, "security_deposit_type": "cash", "security_deposit_currency_code": "USD", "default_to_available": false, "cancellation_policy": "flexible", "services_cleaning": false, "owner_name": "Developers Bridge Rentals", "owner_email": "developers@bridgerentals.com", "owner_phone_number": "+6581872129", "instant_booking": true, "images": [ { "identifier": "3e0db5a041eff3749cf784667a33ef71", "url": "https://dwe6atvmvow8k.cloudfront.net/ru/428403/599584/636162536229252815.png", "caption": "Interior" }, { "identifier": "892c53656c864b506c0a3875b420a51b", "url": "https://dwe6atvmvow8k.cloudfront.net/ru/428403/599584/636162536236428667.png", "caption": "Interior" }, { "identifier": "882161809fc0ee3bcee6957245219908", "url": "https://dwe6atvmvow8k.cloudfront.net/ru/428403/599584/636162536242200503.png", "caption": "Interior" }, { "identifier": "604132ce6a0508a2384e97fac5ce1e81", "url": "https://dwe6atvmvow8k.cloudfront.net/ru/428403/599584/636162536834368604.png", "caption": "Interior" }, { "identifier": "45658e29327481cdc593291d0f93bb54", "url": "https://dwe6atvmvow8k.cloudfront.net/ru/428403/599584/636162536838580630.png", "caption": "Interior" }, { "identifier": "5372b0876d7fe7f668a749e979cc6a00", "url": "https://dwe6atvmvow8k.cloudfront.net/ru/428403/599584/636162536843572064.png", "caption": "Interior" } ], "format": "json", "action": "create", "alias": "current", "controller": "api/v1/host/publish", "publish": { "identifier": "599584", "type": "apartment", "title": "Test Apartment", "description": "Composition: kitchen, bedroom, bathroom, WC\nAmenities: air conditioning, smoking allowed", "address": "115 Amoy street", "postal_code": "069935", "city": "Singapore", "country_code": "SG", "lat": 1.2820967, "lng": 103.8480255, "number_of_bedrooms": 1, "number_of_bathrooms": 1, "floor": -1, "surface": 100, "surface_unit": "metric", "amenities": "airconditioning", "max_guests": 5, "minimum_stay": 1, "multi_unit": false, "smoking_allowed": true, "pets_allowed": false, "check_in_instructions": "Landlord: Developers Bridge Rentals\nEmail: developers@bridgerentals.com\nPhone: +6581872129\nDaysBeforeArrival: 0", "check_in_time": "17:00", "check_out_time": "11:00", "currency": "USD", "nightly_rate": 80, "weekly_rate": 560, "monthly_rate": 2400, "security_deposit_amount": 80, "security_deposit_type": "cash", "security_deposit_currency_code": "USD", "default_to_available": false, "cancellation_policy": "flexible", "services_cleaning": false, "owner_name": "Developers Bridge Rentals", "owner_email": "developers@bridgerentals.com", "owner_phone_number": "+6581872129", "instant_booking": true, "images": [ { "identifier": "3e0db5a041eff3749cf784667a33ef71", "url": "https://dwe6atvmvow8k.cloudfront.net/ru/428403/599584/636162536229252815.png", "caption": "Interior" }, { "identifier": "892c53656c864b506c0a3875b420a51b", "url": "https://dwe6atvmvow8k.cloudfront.net/ru/428403/599584/636162536236428667.png", "caption": "Interior" }, { "identifier": "882161809fc0ee3bcee6957245219908", "url": "https://dwe6atvmvow8k.cloudfront.net/ru/428403/599584/636162536242200503.png", "caption": "Interior" }, { "identifier": "604132ce6a0508a2384e97fac5ce1e81", "url": "https://dwe6atvmvow8k.cloudfront.net/ru/428403/599584/636162536834368604.png", "caption": "Interior" }, { "identifier": "45658e29327481cdc593291d0f93bb54", "url": "https://dwe6atvmvow8k.cloudfront.net/ru/428403/599584/636162536838580630.png", "caption": "Interior" }, { "identifier": "5372b0876d7fe7f668a749e979cc6a00", "url": "https://dwe6atvmvow8k.cloudfront.net/ru/428403/599584/636162536843572064.png", "caption": "Interior" } ] } }, "timestamp": "2017-02-02T09:01:38+00:00", "user": "supplier_rentals_united_sandbox" }
keang commented 7 years ago

This may cause some problems when there are edits on Roomorama (by QC for example) Won't merge this for now.