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.
3615 3616 3617 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 3615 def initialize(client) @client = HttpClient::Preconditions.assert_class('client', client, ::Io::Flow::V0::Client) end |
Instance Method Details
#delete_by_key(organization, key) ⇒ Object
3641 3642 3643 3644 3645 3646 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 3641 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
3626 3627 3628 3629 3630 3631 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 3626 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
3619 3620 3621 3622 3623 3624 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 3619 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
3633 3634 3635 3636 3637 3638 3639 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 3633 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 |