Class: Io::Flow::V0::Clients::OrderBuilders
- Inherits:
-
Object
- Object
- Io::Flow::V0::Clients::OrderBuilders
- Defined in:
- lib/flow_commerce/flow_api_v0_client.rb
Instance Method Summary collapse
-
#get_by_number(organization, number, incoming = {}) ⇒ Object
Returns information about a specific order and any errors associated with the order.
-
#initialize(client) ⇒ OrderBuilders
constructor
A new instance of OrderBuilders.
- #post(organization, order_put_form, incoming = {}) ⇒ Object
- #put_attributes_by_number(organization, number, order_builder_attributes_form, incoming = {}) ⇒ Object
- #put_by_number(organization, number, order_put_form, incoming = {}) ⇒ Object
- #put_carts_by_number(organization, number, order_put_form, incoming = {}) ⇒ Object
- #put_country_by_number(organization, number, order_builder_destination_country_form, incoming = {}) ⇒ Object
- #put_destination_by_number(organization, number, order_builder_destination_form, incoming = {}) ⇒ Object
- #put_duty_by_number(organization, number, order_builder_delivered_duty_form, incoming = {}) ⇒ Object
-
#put_invoice_and_address_by_number(organization, number, order_builder_customer_invoice_address_form, incoming = {}) ⇒ Object
Update the customer invoice address.
-
#put_tax_and_registration_by_number(organization, number, tax_registration_form, incoming = {}) ⇒ Object
Validates a tax registration number, proxying to underlying services and recording the result on the order.
Constructor Details
#initialize(client) ⇒ OrderBuilders
Returns a new instance of OrderBuilders.
1689 1690 1691 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 1689 def initialize(client) @client = HttpClient::Preconditions.assert_class('client', client, ::Io::Flow::V0::Client) end |
Instance Method Details
#get_by_number(organization, number, incoming = {}) ⇒ Object
Returns information about a specific order and any errors associated with the order.
1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 1738 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 1728 def get_by_number(organization, number, incoming={}) HttpClient::Preconditions.assert_class('organization', organization, String) HttpClient::Preconditions.assert_class('number', number, String) opts = HttpClient::Helper.symbolize_keys(incoming) query = { :expand => (x = opts.delete(:expand); x.nil? ? nil : HttpClient::Preconditions.assert_class('expand', x, Array).map { |v| HttpClient::Preconditions.assert_class('expand', v, String) }), :romanize => (x = opts.delete(:romanize); x.nil? ? nil : HttpClient::Preconditions.assert_class('romanize', x, Array).map { |v| HttpClient::Preconditions.assert_class('romanize', v, String) }) }.delete_if { |k, v| v.nil? } r = @client.request("/#{CGI.escape(organization)}/order/builders/#{CGI.escape(number)}").with_query(query).get ::Io::Flow::V0::Models::OrderBuilder.new(r) end |
#post(organization, order_put_form, incoming = {}) ⇒ Object
1693 1694 1695 1696 1697 1698 1699 1700 1701 1702 1703 1704 1705 1706 1707 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 1693 def post(organization, order_put_form, incoming={}) HttpClient::Preconditions.assert_class('organization', organization, String) opts = HttpClient::Helper.symbolize_keys(incoming) query = { :experience => (x = opts.delete(:experience); x.nil? ? nil : HttpClient::Preconditions.assert_class('experience', x, String)), :country => (x = opts.delete(:country); x.nil? ? nil : HttpClient::Preconditions.assert_class('country', x, String)), :ip => (x = opts.delete(:ip); x.nil? ? nil : HttpClient::Preconditions.assert_class('ip', x, String)), :currency => (x = opts.delete(:currency); x.nil? ? nil : HttpClient::Preconditions.assert_class('currency', x, String)), :language => (x = opts.delete(:language); x.nil? ? nil : HttpClient::Preconditions.assert_class('language', x, String)), :expand => (x = opts.delete(:expand); x.nil? ? nil : HttpClient::Preconditions.assert_class('expand', x, Array).map { |v| HttpClient::Preconditions.assert_class('expand', v, String) }) }.delete_if { |k, v| v.nil? } (x = order_put_form; x.is_a?(::Io::Flow::V0::Models::OrderPutForm) ? x : ::Io::Flow::V0::Models::OrderPutForm.new(x)) r = @client.request("/#{CGI.escape(organization)}/order/builders").with_query(query).with_json(order_put_form.to_json).post ::Io::Flow::V0::Models::OrderBuilder.new(r) end |
#put_attributes_by_number(organization, number, order_builder_attributes_form, incoming = {}) ⇒ Object
1757 1758 1759 1760 1761 1762 1763 1764 1765 1766 1767 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 1757 def put_attributes_by_number(organization, number, order_builder_attributes_form, incoming={}) HttpClient::Preconditions.assert_class('organization', organization, String) HttpClient::Preconditions.assert_class('number', number, String) opts = HttpClient::Helper.symbolize_keys(incoming) query = { :expand => (x = opts.delete(:expand); x.nil? ? nil : HttpClient::Preconditions.assert_class('expand', x, Array).map { |v| HttpClient::Preconditions.assert_class('expand', v, String) }) }.delete_if { |k, v| v.nil? } (x = order_builder_attributes_form; x.is_a?(::Io::Flow::V0::Models::OrderBuilderAttributesForm) ? x : ::Io::Flow::V0::Models::OrderBuilderAttributesForm.new(x)) r = @client.request("/#{CGI.escape(organization)}/order/builders/#{CGI.escape(number)}/attributes").with_query(query).with_json(order_builder_attributes_form.to_json).put ::Io::Flow::V0::Models::OrderBuilder.new(r) end |
#put_by_number(organization, number, order_put_form, incoming = {}) ⇒ Object
1740 1741 1742 1743 1744 1745 1746 1747 1748 1749 1750 1751 1752 1753 1754 1755 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 1740 def put_by_number(organization, number, order_put_form, incoming={}) HttpClient::Preconditions.assert_class('organization', organization, String) HttpClient::Preconditions.assert_class('number', number, String) opts = HttpClient::Helper.symbolize_keys(incoming) query = { :experience => (x = opts.delete(:experience); x.nil? ? nil : HttpClient::Preconditions.assert_class('experience', x, String)), :country => (x = opts.delete(:country); x.nil? ? nil : HttpClient::Preconditions.assert_class('country', x, String)), :ip => (x = opts.delete(:ip); x.nil? ? nil : HttpClient::Preconditions.assert_class('ip', x, String)), :currency => (x = opts.delete(:currency); x.nil? ? nil : HttpClient::Preconditions.assert_class('currency', x, String)), :language => (x = opts.delete(:language); x.nil? ? nil : HttpClient::Preconditions.assert_class('language', x, String)), :expand => (x = opts.delete(:expand); x.nil? ? nil : HttpClient::Preconditions.assert_class('expand', x, Array).map { |v| HttpClient::Preconditions.assert_class('expand', v, String) }) }.delete_if { |k, v| v.nil? } (x = order_put_form; x.is_a?(::Io::Flow::V0::Models::OrderPutForm) ? x : ::Io::Flow::V0::Models::OrderPutForm.new(x)) r = @client.request("/#{CGI.escape(organization)}/order/builders/#{CGI.escape(number)}").with_query(query).with_json(order_put_form.to_json).put ::Io::Flow::V0::Models::OrderBuilder.new(r) end |
#put_carts_by_number(organization, number, order_put_form, incoming = {}) ⇒ Object
1709 1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 1724 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 1709 def put_carts_by_number(organization, number, order_put_form, incoming={}) HttpClient::Preconditions.assert_class('organization', organization, String) HttpClient::Preconditions.assert_class('number', number, String) opts = HttpClient::Helper.symbolize_keys(incoming) query = { :experience => (x = opts.delete(:experience); x.nil? ? nil : HttpClient::Preconditions.assert_class('experience', x, String)), :country => (x = opts.delete(:country); x.nil? ? nil : HttpClient::Preconditions.assert_class('country', x, String)), :ip => (x = opts.delete(:ip); x.nil? ? nil : HttpClient::Preconditions.assert_class('ip', x, String)), :currency => (x = opts.delete(:currency); x.nil? ? nil : HttpClient::Preconditions.assert_class('currency', x, String)), :language => (x = opts.delete(:language); x.nil? ? nil : HttpClient::Preconditions.assert_class('language', x, String)), :expand => (x = opts.delete(:expand); x.nil? ? nil : HttpClient::Preconditions.assert_class('expand', x, Array).map { |v| HttpClient::Preconditions.assert_class('expand', v, String) }) }.delete_if { |k, v| v.nil? } (x = order_put_form; x.is_a?(::Io::Flow::V0::Models::OrderPutForm) ? x : ::Io::Flow::V0::Models::OrderPutForm.new(x)) r = @client.request("/#{CGI.escape(organization)}/order/builders/carts/#{CGI.escape(number)}").with_query(query).with_json(order_put_form.to_json).put ::Io::Flow::V0::Models::OrderBuilder.new(r) end |
#put_country_by_number(organization, number, order_builder_destination_country_form, incoming = {}) ⇒ Object
1769 1770 1771 1772 1773 1774 1775 1776 1777 1778 1779 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 1769 def put_country_by_number(organization, number, order_builder_destination_country_form, incoming={}) HttpClient::Preconditions.assert_class('organization', organization, String) HttpClient::Preconditions.assert_class('number', number, String) opts = HttpClient::Helper.symbolize_keys(incoming) query = { :expand => (x = opts.delete(:expand); x.nil? ? nil : HttpClient::Preconditions.assert_class('expand', x, Array).map { |v| HttpClient::Preconditions.assert_class('expand', v, String) }) }.delete_if { |k, v| v.nil? } (x = order_builder_destination_country_form; x.is_a?(::Io::Flow::V0::Models::OrderBuilderDestinationCountryForm) ? x : ::Io::Flow::V0::Models::OrderBuilderDestinationCountryForm.new(x)) r = @client.request("/#{CGI.escape(organization)}/order/builders/#{CGI.escape(number)}/country").with_query(query).with_json(order_builder_destination_country_form.to_json).put ::Io::Flow::V0::Models::OrderBuilder.new(r) end |
#put_destination_by_number(organization, number, order_builder_destination_form, incoming = {}) ⇒ Object
1781 1782 1783 1784 1785 1786 1787 1788 1789 1790 1791 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 1781 def put_destination_by_number(organization, number, order_builder_destination_form, incoming={}) HttpClient::Preconditions.assert_class('organization', organization, String) HttpClient::Preconditions.assert_class('number', number, String) opts = HttpClient::Helper.symbolize_keys(incoming) query = { :expand => (x = opts.delete(:expand); x.nil? ? nil : HttpClient::Preconditions.assert_class('expand', x, Array).map { |v| HttpClient::Preconditions.assert_class('expand', v, String) }) }.delete_if { |k, v| v.nil? } (x = order_builder_destination_form; x.is_a?(::Io::Flow::V0::Models::OrderBuilderDestinationForm) ? x : ::Io::Flow::V0::Models::OrderBuilderDestinationForm.new(x)) r = @client.request("/#{CGI.escape(organization)}/order/builders/#{CGI.escape(number)}/destination").with_query(query).with_json(order_builder_destination_form.to_json).put ::Io::Flow::V0::Models::OrderBuilder.new(r) end |
#put_duty_by_number(organization, number, order_builder_delivered_duty_form, incoming = {}) ⇒ Object
1793 1794 1795 1796 1797 1798 1799 1800 1801 1802 1803 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 1793 def put_duty_by_number(organization, number, order_builder_delivered_duty_form, incoming={}) HttpClient::Preconditions.assert_class('organization', organization, String) HttpClient::Preconditions.assert_class('number', number, String) opts = HttpClient::Helper.symbolize_keys(incoming) query = { :expand => (x = opts.delete(:expand); x.nil? ? nil : HttpClient::Preconditions.assert_class('expand', x, Array).map { |v| HttpClient::Preconditions.assert_class('expand', v, String) }) }.delete_if { |k, v| v.nil? } (x = order_builder_delivered_duty_form; x.is_a?(::Io::Flow::V0::Models::OrderBuilderDeliveredDutyForm) ? x : ::Io::Flow::V0::Models::OrderBuilderDeliveredDutyForm.new(x)) r = @client.request("/#{CGI.escape(organization)}/order/builders/#{CGI.escape(number)}/duty").with_query(query).with_json(order_builder_delivered_duty_form.to_json).put ::Io::Flow::V0::Models::OrderBuilder.new(r) end |
#put_invoice_and_address_by_number(organization, number, order_builder_customer_invoice_address_form, incoming = {}) ⇒ Object
Update the customer invoice address
1806 1807 1808 1809 1810 1811 1812 1813 1814 1815 1816 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 1806 def put_invoice_and_address_by_number(organization, number, order_builder_customer_invoice_address_form, incoming={}) HttpClient::Preconditions.assert_class('organization', organization, String) HttpClient::Preconditions.assert_class('number', number, String) opts = HttpClient::Helper.symbolize_keys(incoming) query = { :expand => (x = opts.delete(:expand); x.nil? ? nil : HttpClient::Preconditions.assert_class('expand', x, Array).map { |v| HttpClient::Preconditions.assert_class('expand', v, String) }) }.delete_if { |k, v| v.nil? } (x = order_builder_customer_invoice_address_form; x.is_a?(::Io::Flow::V0::Models::OrderBuilderCustomerInvoiceAddressForm) ? x : ::Io::Flow::V0::Models::OrderBuilderCustomerInvoiceAddressForm.new(x)) r = @client.request("/#{CGI.escape(organization)}/order/builders/#{CGI.escape(number)}/invoice/address").with_query(query).with_json(order_builder_customer_invoice_address_form.to_json).put ::Io::Flow::V0::Models::OrderBuilder.new(r) end |
#put_tax_and_registration_by_number(organization, number, tax_registration_form, incoming = {}) ⇒ Object
Validates a tax registration number, proxying to underlying services and recording the result on the order.
1820 1821 1822 1823 1824 1825 1826 1827 1828 1829 1830 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 1820 def put_tax_and_registration_by_number(organization, number, tax_registration_form, incoming={}) HttpClient::Preconditions.assert_class('organization', organization, String) HttpClient::Preconditions.assert_class('number', number, String) opts = HttpClient::Helper.symbolize_keys(incoming) query = { :expand => (x = opts.delete(:expand); x.nil? ? nil : HttpClient::Preconditions.assert_class('expand', x, Array).map { |v| HttpClient::Preconditions.assert_class('expand', v, String) }) }.delete_if { |k, v| v.nil? } (x = tax_registration_form; x.is_a?(::Io::Flow::V0::Models::TaxRegistrationForm) ? x : ::Io::Flow::V0::Models::TaxRegistrationForm.new(x)) r = @client.request("/#{CGI.escape(organization)}/order/builders/#{CGI.escape(number)}/tax/registration").with_query(query).with_json(tax_registration_form.to_json).put ::Io::Flow::V0::Models::OrderBuilder.new(r) end |