Skip to content

Instantly share code, notes, and snippets.

@avidas
Created December 27, 2017 17:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save avidas/886555986e656d55da86f3aaa9621639 to your computer and use it in GitHub Desktop.
Save avidas/886555986e656d55da86f3aaa9621639 to your computer and use it in GitHub Desktop.
begin
account = Account.find_by_short_code '7RFQTX'
location = Location.find_by_code 'ATL02'
price = account.anywhere_reservations.active.first.price
start_jan_date = Date.today.next_month.beginning_of_month
end_feb_date = Date.today.next_month.next_month.end_of_month
full_discount_for_two_months = { type: "discount", started_on: start_jan_date, ended_on: end_feb_date, price: -price }
Anywhere::ReservationService.new(account, location).apply_addon(full_discount_for_two_months)
end
@tyjet
Copy link

tyjet commented Dec 27, 2017

👍

@jhjwind
Copy link

jhjwind commented Dec 27, 2017

Do you need to switch tenant?

@avidas
Copy link
Author

avidas commented Dec 27, 2017

@jhjwind tenant switch happens when Anywhere::ReservationService is initialized with the location

@jhjwind
Copy link

jhjwind commented Dec 27, 2017

👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment