Class: Io::Flow::V0::Client
- Inherits:
-
Object
- Object
- Io::Flow::V0::Client
- Defined in:
- lib/flow_commerce/flow_api_v0_client.rb
Defined Under Namespace
Modules: Constants
Instance Attribute Summary collapse
-
#url ⇒ Object
readonly
Returns the value of attribute url.
Class Method Summary collapse
-
.at_base_url(opts = {}) ⇒ Object
Creates an instance of the client using the base url specified in the API spec.
Instance Method Summary collapse
- #addresses ⇒ Object
- #attributes ⇒ Object
- #authorizations ⇒ Object
- #captures ⇒ Object
- #cards ⇒ Object
- #carriers ⇒ Object
- #catalogs ⇒ Object
- #centers ⇒ Object
- #countries ⇒ Object
- #country_defaults ⇒ Object
- #currencies ⇒ Object
- #delivery_windows ⇒ Object
- #documents ⇒ Object
- #duties ⇒ Object
- #email_verifications ⇒ Object
- #experiences ⇒ Object
- #exports ⇒ Object
- #harmonization_settings ⇒ Object
- #harmonized_categories ⇒ Object
- #harmonized_item_duties ⇒ Object
- #harmonized_items ⇒ Object
- #harmonized_landed_costs ⇒ Object
- #healthchecks ⇒ Object
- #hs10 ⇒ Object
- #hs6 ⇒ Object
-
#initialize(url, opts = {}) ⇒ Client
constructor
A new instance of Client.
- #inventory_rules ⇒ Object
- #inventory_snapshots ⇒ Object
- #inventory_updates ⇒ Object
- #invitations ⇒ Object
- #item_functions ⇒ Object
- #items ⇒ Object
- #languages ⇒ Object
- #memberships ⇒ Object
- #order_estimates ⇒ Object
- #orders ⇒ Object
- #organization_authorizations ⇒ Object
- #organization_currency_settings ⇒ Object
- #organizations ⇒ Object
- #password_reset_forms ⇒ Object
- #public_keys ⇒ Object
- #queries ⇒ Object
- #quote_estimates ⇒ Object
- #quotes ⇒ Object
- #rates ⇒ Object
- #refunds ⇒ Object
- #regions ⇒ Object
- #request(path = nil) ⇒ Object
- #services ⇒ Object
- #shipping_labels ⇒ Object
- #shipping_notifications ⇒ Object
- #spot_rates ⇒ Object
- #subcatalog_items ⇒ Object
- #subcatalogs ⇒ Object
- #suggestions ⇒ Object
- #targeting_items ⇒ Object
- #targetings ⇒ Object
- #taxes ⇒ Object
- #tier_defaults ⇒ Object
- #tier_rules ⇒ Object
- #tiers ⇒ Object
- #timezones ⇒ Object
- #token_validations ⇒ Object
- #tokens ⇒ Object
- #tracking_events ⇒ Object
- #tracking_labels ⇒ Object
- #trackings ⇒ Object
- #users ⇒ Object
- #webhook_deliveries ⇒ Object
- #webhooks ⇒ Object
Constructor Details
#initialize(url, opts = {}) ⇒ Client
Returns a new instance of Client.
36 37 38 39 40 41 42 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 36 def initialize(url, opts={}) @url = HttpClient::Preconditions.assert_class('url', url, String) @authorization = HttpClient::Preconditions.assert_class_or_nil('authorization', opts.delete(:authorization), HttpClient::Authorization) @default_headers = HttpClient::Preconditions.assert_class('default_headers', opts.delete(:default_headers) || {}, Hash) HttpClient::Preconditions.assert_empty_opts(opts) HttpClient::Preconditions.check_state(url.match(/http.+/i), "URL[%s] must start with http" % url) end |
Instance Attribute Details
#url ⇒ Object (readonly)
Returns the value of attribute url.
34 35 36 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 34 def url @url end |
Class Method Details
Instance Method Details
#addresses ⇒ Object
260 261 262 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 260 def addresses @addresses ||= ::Io::Flow::V0::Clients::Addresses.new(self) end |
#attributes ⇒ Object
64 65 66 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 64 def attributes @attributes ||= ::Io::Flow::V0::Clients::Attributes.new(self) end |
#authorizations ⇒ Object
164 165 166 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 164 def @authorizations ||= ::Io::Flow::V0::Clients::Authorizations.new(self) end |
#captures ⇒ Object
168 169 170 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 168 def captures @captures ||= ::Io::Flow::V0::Clients::Captures.new(self) end |
#cards ⇒ Object
172 173 174 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 172 def cards @cards ||= ::Io::Flow::V0::Clients::Cards.new(self) end |
#carriers ⇒ Object
184 185 186 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 184 def carriers @carriers ||= ::Io::Flow::V0::Clients::Carriers.new(self) end |
#catalogs ⇒ Object
68 69 70 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 68 def catalogs @catalogs ||= ::Io::Flow::V0::Clients::Catalogs.new(self) end |
#centers ⇒ Object
188 189 190 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 188 def centers @centers ||= ::Io::Flow::V0::Clients::Centers.new(self) end |
#countries ⇒ Object
272 273 274 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 272 def countries @countries ||= ::Io::Flow::V0::Clients::Countries.new(self) end |
#country_defaults ⇒ Object
264 265 266 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 264 def country_defaults @country_defaults ||= ::Io::Flow::V0::Clients::CountryDefaults.new(self) end |
#currencies ⇒ Object
276 277 278 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 276 def currencies @currencies ||= ::Io::Flow::V0::Clients::Currencies.new(self) end |
#delivery_windows ⇒ Object
192 193 194 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 192 def delivery_windows @delivery_windows ||= ::Io::Flow::V0::Clients::DeliveryWindows.new(self) end |
#documents ⇒ Object
288 289 290 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 288 def documents @documents ||= ::Io::Flow::V0::Clients::Documents.new(self) end |
#duties ⇒ Object
128 129 130 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 128 def duties @duties ||= ::Io::Flow::V0::Clients::Duties.new(self) end |
#email_verifications ⇒ Object
292 293 294 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 292 def email_verifications @email_verifications ||= ::Io::Flow::V0::Clients::EmailVerifications.new(self) end |
#experiences ⇒ Object
72 73 74 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 72 def experiences @experiences ||= ::Io::Flow::V0::Clients::Experiences.new(self) end |
#exports ⇒ Object
296 297 298 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 296 def exports @exports ||= ::Io::Flow::V0::Clients::Exports.new(self) end |
#harmonization_settings ⇒ Object
132 133 134 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 132 def harmonization_settings @harmonization_settings ||= ::Io::Flow::V0::Clients::HarmonizationSettings.new(self) end |
#harmonized_categories ⇒ Object
136 137 138 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 136 def harmonized_categories @harmonized_categories ||= ::Io::Flow::V0::Clients::HarmonizedCategories.new(self) end |
#harmonized_item_duties ⇒ Object
144 145 146 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 144 def harmonized_item_duties @harmonized_item_duties ||= ::Io::Flow::V0::Clients::HarmonizedItemDuties.new(self) end |
#harmonized_items ⇒ Object
140 141 142 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 140 def harmonized_items @harmonized_items ||= ::Io::Flow::V0::Clients::HarmonizedItems.new(self) end |
#harmonized_landed_costs ⇒ Object
148 149 150 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 148 def harmonized_landed_costs @harmonized_landed_costs ||= ::Io::Flow::V0::Clients::HarmonizedLandedCosts.new(self) end |
#healthchecks ⇒ Object
300 301 302 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 300 def healthchecks @healthchecks ||= ::Io::Flow::V0::Clients::Healthchecks.new(self) end |
#hs10 ⇒ Object
152 153 154 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 152 def hs10 @hs10 ||= ::Io::Flow::V0::Clients::Hs10.new(self) end |
#hs6 ⇒ Object
156 157 158 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 156 def hs6 @hs6 ||= ::Io::Flow::V0::Clients::Hs6.new(self) end |
#inventory_rules ⇒ Object
196 197 198 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 196 def inventory_rules @inventory_rules ||= ::Io::Flow::V0::Clients::InventoryRules.new(self) end |
#inventory_snapshots ⇒ Object
200 201 202 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 200 def inventory_snapshots @inventory_snapshots ||= ::Io::Flow::V0::Clients::InventorySnapshots.new(self) end |
#inventory_updates ⇒ Object
204 205 206 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 204 def inventory_updates @inventory_updates ||= ::Io::Flow::V0::Clients::InventoryUpdates.new(self) end |
#invitations ⇒ Object
304 305 306 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 304 def invitations @invitations ||= ::Io::Flow::V0::Clients::Invitations.new(self) end |
#item_functions ⇒ Object
112 113 114 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 112 def item_functions @item_functions ||= ::Io::Flow::V0::Clients::ItemFunctions.new(self) end |
#items ⇒ Object
76 77 78 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 76 def items @items ||= ::Io::Flow::V0::Clients::Items.new(self) end |
#languages ⇒ Object
280 281 282 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 280 def languages @languages ||= ::Io::Flow::V0::Clients::Languages.new(self) end |
#memberships ⇒ Object
308 309 310 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 308 def memberships @memberships ||= ::Io::Flow::V0::Clients::Memberships.new(self) end |
#order_estimates ⇒ Object
84 85 86 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 84 def order_estimates @order_estimates ||= ::Io::Flow::V0::Clients::OrderEstimates.new(self) end |
#orders ⇒ Object
80 81 82 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 80 def orders @orders ||= ::Io::Flow::V0::Clients::Orders.new(self) end |
#organization_authorizations ⇒ Object
312 313 314 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 312 def @organization_authorizations ||= ::Io::Flow::V0::Clients::OrganizationAuthorizations.new(self) end |
#organization_currency_settings ⇒ Object
116 117 118 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 116 def organization_currency_settings @organization_currency_settings ||= ::Io::Flow::V0::Clients::OrganizationCurrencySettings.new(self) end |
#organizations ⇒ Object
88 89 90 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 88 def organizations @organizations ||= ::Io::Flow::V0::Clients::Organizations.new(self) end |
#password_reset_forms ⇒ Object
316 317 318 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 316 def password_reset_forms @password_reset_forms ||= ::Io::Flow::V0::Clients::PasswordResetForms.new(self) end |
#public_keys ⇒ Object
176 177 178 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 176 def public_keys @public_keys ||= ::Io::Flow::V0::Clients::PublicKeys.new(self) end |
#queries ⇒ Object
92 93 94 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 92 def queries @queries ||= ::Io::Flow::V0::Clients::Queries.new(self) end |
#quote_estimates ⇒ Object
212 213 214 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 212 def quote_estimates @quote_estimates ||= ::Io::Flow::V0::Clients::QuoteEstimates.new(self) end |
#quotes ⇒ Object
208 209 210 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 208 def quotes @quotes ||= ::Io::Flow::V0::Clients::Quotes.new(self) end |
#rates ⇒ Object
120 121 122 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 120 def rates @rates ||= ::Io::Flow::V0::Clients::Rates.new(self) end |
#refunds ⇒ Object
180 181 182 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 180 def refunds @refunds ||= ::Io::Flow::V0::Clients::Refunds.new(self) end |
#regions ⇒ Object
284 285 286 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 284 def regions @regions ||= ::Io::Flow::V0::Clients::Regions.new(self) end |
#request(path = nil) ⇒ Object
49 50 51 52 53 54 55 56 57 58 59 60 61 62 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 49 def request(path=nil) HttpClient::Preconditions.assert_class_or_nil('path', path, String) request = HttpClient::Request.new(URI.parse(@url + path.to_s)).with_header('User-Agent', Constants::USER_AGENT).with_header('X-Apidoc-Version', Constants::VERSION).with_header('X-Apidoc-Version-Major', Constants::VERSION_MAJOR) @default_headers.each do |key, value| request = request.with_header(key, value) end if @authorization request = request.with_auth(@authorization) end request end |
#services ⇒ Object
216 217 218 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 216 def services @services ||= ::Io::Flow::V0::Clients::Services.new(self) end |
#shipping_labels ⇒ Object
220 221 222 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 220 def shipping_labels @shipping_labels ||= ::Io::Flow::V0::Clients::ShippingLabels.new(self) end |
#shipping_notifications ⇒ Object
224 225 226 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 224 def shipping_notifications @shipping_notifications ||= ::Io::Flow::V0::Clients::ShippingNotifications.new(self) end |
#spot_rates ⇒ Object
124 125 126 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 124 def spot_rates @spot_rates ||= ::Io::Flow::V0::Clients::SpotRates.new(self) end |
#subcatalog_items ⇒ Object
100 101 102 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 100 def subcatalog_items @subcatalog_items ||= ::Io::Flow::V0::Clients::SubcatalogItems.new(self) end |
#subcatalogs ⇒ Object
96 97 98 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 96 def subcatalogs @subcatalogs ||= ::Io::Flow::V0::Clients::Subcatalogs.new(self) end |
#suggestions ⇒ Object
320 321 322 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 320 def suggestions @suggestions ||= ::Io::Flow::V0::Clients::Suggestions.new(self) end |
#targeting_items ⇒ Object
108 109 110 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 108 def targeting_items @targeting_items ||= ::Io::Flow::V0::Clients::TargetingItems.new(self) end |
#targetings ⇒ Object
104 105 106 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 104 def targetings @targetings ||= ::Io::Flow::V0::Clients::Targetings.new(self) end |
#taxes ⇒ Object
160 161 162 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 160 def taxes @taxes ||= ::Io::Flow::V0::Clients::Taxes.new(self) end |
#tier_defaults ⇒ Object
232 233 234 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 232 def tier_defaults @tier_defaults ||= ::Io::Flow::V0::Clients::TierDefaults.new(self) end |
#tier_rules ⇒ Object
236 237 238 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 236 def tier_rules @tier_rules ||= ::Io::Flow::V0::Clients::TierRules.new(self) end |
#tiers ⇒ Object
228 229 230 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 228 def tiers @tiers ||= ::Io::Flow::V0::Clients::Tiers.new(self) end |
#timezones ⇒ Object
268 269 270 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 268 def timezones @timezones ||= ::Io::Flow::V0::Clients::Timezones.new(self) end |
#token_validations ⇒ Object
328 329 330 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 328 def token_validations @token_validations ||= ::Io::Flow::V0::Clients::TokenValidations.new(self) end |
#tokens ⇒ Object
324 325 326 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 324 def tokens @tokens ||= ::Io::Flow::V0::Clients::Tokens.new(self) end |
#tracking_events ⇒ Object
244 245 246 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 244 def tracking_events @tracking_events ||= ::Io::Flow::V0::Clients::TrackingEvents.new(self) end |
#tracking_labels ⇒ Object
248 249 250 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 248 def tracking_labels @tracking_labels ||= ::Io::Flow::V0::Clients::TrackingLabels.new(self) end |
#trackings ⇒ Object
240 241 242 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 240 def trackings @trackings ||= ::Io::Flow::V0::Clients::Trackings.new(self) end |
#users ⇒ Object
332 333 334 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 332 def users @users ||= ::Io::Flow::V0::Clients::Users.new(self) end |