Class: Io::Flow::V0::Clients::Reservations
- Inherits:
-
Object
- Object
- Io::Flow::V0::Clients::Reservations
- Defined in:
- lib/flow_commerce/flow_api_v0_client.rb
Instance Method Summary collapse
- #delete_by_key(organization, key) ⇒ Object
- #get_by_key(organization, key) ⇒ Object
-
#initialize(client) ⇒ Reservations
constructor
A new instance of Reservations.
- #post(organization, reservation_form) ⇒ Object
- #put_by_key(organization, key, reservation_form) ⇒ Object
Constructor Details
#initialize(client) ⇒ Reservations
Returns a new instance of Reservations.
3584 3585 3586 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 3584 def initialize(client) @client = HttpClient::Preconditions.assert_class('client', client, ::Io::Flow::V0::Client) end |
Instance Method Details
#delete_by_key(organization, key) ⇒ Object
3610 3611 3612 3613 3614 3615 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 3610 def delete_by_key(organization, key) HttpClient::Preconditions.assert_class('organization', organization, String) HttpClient::Preconditions.assert_class('key', key, String) r = @client.request("/#{CGI.escape(organization)}/inventory/reservation/#{CGI.escape(key)}").delete nil end |
#get_by_key(organization, key) ⇒ Object
3595 3596 3597 3598 3599 3600 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 3595 def get_by_key(organization, key) HttpClient::Preconditions.assert_class('organization', organization, String) HttpClient::Preconditions.assert_class('key', key, String) r = @client.request("/#{CGI.escape(organization)}/inventory/reservation/#{CGI.escape(key)}").get ::Io::Flow::V0::Models::Reservation.new(r) end |
#post(organization, reservation_form) ⇒ Object
3588 3589 3590 3591 3592 3593 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 3588 def post(organization, reservation_form) HttpClient::Preconditions.assert_class('organization', organization, String) (x = reservation_form; x.is_a?(::Io::Flow::V0::Models::ReservationForm) ? x : ::Io::Flow::V0::Models::ReservationForm.new(x)) r = @client.request("/#{CGI.escape(organization)}/inventory/reservation").with_json(reservation_form.to_json).post ::Io::Flow::V0::Models::Reservation.new(r) end |
#put_by_key(organization, key, reservation_form) ⇒ Object
3602 3603 3604 3605 3606 3607 3608 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 3602 def put_by_key(organization, key, reservation_form) HttpClient::Preconditions.assert_class('organization', organization, String) HttpClient::Preconditions.assert_class('key', key, String) (x = reservation_form; x.is_a?(::Io::Flow::V0::Models::ReservationForm) ? x : ::Io::Flow::V0::Models::ReservationForm.new(x)) r = @client.request("/#{CGI.escape(organization)}/inventory/reservation/#{CGI.escape(key)}").with_json(reservation_form.to_json).put ::Io::Flow::V0::Models::Reservation.new(r) end |