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.
1804 1805 1806 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 1804 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.
1843 1844 1845 1846 1847 1848 1849 1850 1851 1852 1853 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 1843 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
1808 1809 1810 1811 1812 1813 1814 1815 1816 1817 1818 1819 1820 1821 1822 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 1808 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
1872 1873 1874 1875 1876 1877 1878 1879 1880 1881 1882 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 1872 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
1855 1856 1857 1858 1859 1860 1861 1862 1863 1864 1865 1866 1867 1868 1869 1870 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 1855 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
1824 1825 1826 1827 1828 1829 1830 1831 1832 1833 1834 1835 1836 1837 1838 1839 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 1824 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
1884 1885 1886 1887 1888 1889 1890 1891 1892 1893 1894 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 1884 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
1896 1897 1898 1899 1900 1901 1902 1903 1904 1905 1906 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 1896 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
1908 1909 1910 1911 1912 1913 1914 1915 1916 1917 1918 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 1908 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
1921 1922 1923 1924 1925 1926 1927 1928 1929 1930 1931 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 1921 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.
1935 1936 1937 1938 1939 1940 1941 1942 1943 1944 1945 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 1935 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 |