Class: Io::Flow::V0::Client

Inherits:
Object
  • Object
show all
Defined in:
lib/flow_commerce/flow_api_v0_client.rb

Defined Under Namespace

Modules: Constants

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(url, opts = {}) ⇒ Client

Returns a new instance of Client.



36
37
38
39
40
41
42
43
44
45
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 36

def initialize(url, opts={})
  @url = HttpClient::Preconditions.assert_class('url', url, String)
  @base_url = URI(url)
  @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)
  @http_handler = opts.delete(:http_handler) || HttpClient::DefaultHttpHandler.new

  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

#urlObject (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

.at_base_url(opts = {}) ⇒ Object

Creates an instance of the client using the base url specified in the API spec.



48
49
50
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 48

def Client.at_base_url(opts={})
  Client.new(Constants::BASE_URL, opts)
end

Instance Method Details

#addressesObject



291
292
293
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 291

def addresses
  @addresses ||= ::Io::Flow::V0::Clients::Addresses.new(self)
end

#allocationsObject



67
68
69
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 67

def allocations
  @allocations ||= ::Io::Flow::V0::Clients::Allocations.new(self)
end

#attributesObject



71
72
73
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 71

def attributes
  @attributes ||= ::Io::Flow::V0::Clients::Attributes.new(self)
end

#authorizationsObject



187
188
189
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 187

def authorizations
  @authorizations ||= ::Io::Flow::V0::Clients::Authorizations.new(self)
end

#capturesObject



191
192
193
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 191

def captures
  @captures ||= ::Io::Flow::V0::Clients::Captures.new(self)
end

#cardsObject



195
196
197
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 195

def cards
  @cards ||= ::Io::Flow::V0::Clients::Cards.new(self)
end

#catalogsObject



75
76
77
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 75

def catalogs
  @catalogs ||= ::Io::Flow::V0::Clients::Catalogs.new(self)
end

#centersObject



215
216
217
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 215

def centers
  @centers ||= ::Io::Flow::V0::Clients::Centers.new(self)
end

#countriesObject



303
304
305
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 303

def countries
  @countries ||= ::Io::Flow::V0::Clients::Countries.new(self)
end

#country_defaultsObject



295
296
297
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 295

def country_defaults
  @country_defaults ||= ::Io::Flow::V0::Clients::CountryDefaults.new(self)
end

#credit_paymentsObject



79
80
81
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 79

def credit_payments
  @credit_payments ||= ::Io::Flow::V0::Clients::CreditPayments.new(self)
end

#currenciesObject



307
308
309
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 307

def currencies
  @currencies ||= ::Io::Flow::V0::Clients::Currencies.new(self)
end

#delivery_windowsObject



219
220
221
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 219

def delivery_windows
  @delivery_windows ||= ::Io::Flow::V0::Clients::DeliveryWindows.new(self)
end

#documentsObject



331
332
333
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 331

def documents
  @documents ||= ::Io::Flow::V0::Clients::Documents.new(self)
end

#email_verificationsObject



335
336
337
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 335

def email_verifications
  @email_verifications ||= ::Io::Flow::V0::Clients::EmailVerifications.new(self)
end

#experience_defaultsObject



87
88
89
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 87

def experience_defaults
  @experience_defaults ||= ::Io::Flow::V0::Clients::ExperienceDefaults.new(self)
end

#experiencesObject



83
84
85
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 83

def experiences
  @experiences ||= ::Io::Flow::V0::Clients::Experiences.new(self)
end

#exportsObject



339
340
341
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 339

def exports
  @exports ||= ::Io::Flow::V0::Clients::Exports.new(self)
end

#feedsObject



343
344
345
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 343

def feeds
  @feeds ||= ::Io::Flow::V0::Clients::Feeds.new(self)
end

#harmonization_settingsObject



151
152
153
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 151

def harmonization_settings
  @harmonization_settings ||= ::Io::Flow::V0::Clients::HarmonizationSettings.new(self)
end

#harmonized_categoriesObject



155
156
157
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 155

def harmonized_categories
  @harmonized_categories ||= ::Io::Flow::V0::Clients::HarmonizedCategories.new(self)
end

#harmonized_item_dutiesObject



163
164
165
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 163

def harmonized_item_duties
  @harmonized_item_duties ||= ::Io::Flow::V0::Clients::HarmonizedItemDuties.new(self)
end

#harmonized_itemsObject



159
160
161
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 159

def harmonized_items
  @harmonized_items ||= ::Io::Flow::V0::Clients::HarmonizedItems.new(self)
end

#harmonized_landed_costsObject



167
168
169
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 167

def harmonized_landed_costs
  @harmonized_landed_costs ||= ::Io::Flow::V0::Clients::HarmonizedLandedCosts.new(self)
end

#healthchecksObject



347
348
349
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 347

def healthchecks
  @healthchecks ||= ::Io::Flow::V0::Clients::Healthchecks.new(self)
end

#hs10Object



171
172
173
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 171

def hs10
  @hs10 ||= ::Io::Flow::V0::Clients::Hs10.new(self)
end

#hs6Object



175
176
177
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 175

def hs6
  @hs6 ||= ::Io::Flow::V0::Clients::Hs6.new(self)
end

#hs_codesObject



179
180
181
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 179

def hs_codes
  @hs_codes ||= ::Io::Flow::V0::Clients::HsCodes.new(self)
end

#importsObject



351
352
353
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 351

def imports
  @imports ||= ::Io::Flow::V0::Clients::Imports.new(self)
end

#inventory_rulesObject



223
224
225
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 223

def inventory_rules
  @inventory_rules ||= ::Io::Flow::V0::Clients::InventoryRules.new(self)
end

#inventory_snapshotsObject



227
228
229
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 227

def inventory_snapshots
  @inventory_snapshots ||= ::Io::Flow::V0::Clients::InventorySnapshots.new(self)
end

#inventory_updatesObject



231
232
233
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 231

def inventory_updates
  @inventory_updates ||= ::Io::Flow::V0::Clients::InventoryUpdates.new(self)
end

#invitationsObject



355
356
357
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 355

def invitations
  @invitations ||= ::Io::Flow::V0::Clients::Invitations.new(self)
end

#item_functionsObject



139
140
141
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 139

def item_functions
  @item_functions ||= ::Io::Flow::V0::Clients::ItemFunctions.new(self)
end

#itemsObject



91
92
93
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 91

def items
  @items ||= ::Io::Flow::V0::Clients::Items.new(self)
end

#languagesObject



311
312
313
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 311

def languages
  @languages ||= ::Io::Flow::V0::Clients::Languages.new(self)
end


359
360
361
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 359

def links
  @links ||= ::Io::Flow::V0::Clients::Links.new(self)
end

#localesObject



315
316
317
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 315

def locales
  @locales ||= ::Io::Flow::V0::Clients::Locales.new(self)
end

#manifestsObject



235
236
237
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 235

def manifests
  @manifests ||= ::Io::Flow::V0::Clients::Manifests.new(self)
end

#membershipsObject



363
364
365
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 363

def memberships
  @memberships ||= ::Io::Flow::V0::Clients::Memberships.new(self)
end

#order_estimatesObject



99
100
101
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 99

def order_estimates
  @order_estimates ||= ::Io::Flow::V0::Clients::OrderEstimates.new(self)
end

#order_identifiersObject



103
104
105
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 103

def order_identifiers
  @order_identifiers ||= ::Io::Flow::V0::Clients::OrderIdentifiers.new(self)
end

#order_promotionsObject



107
108
109
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 107

def order_promotions
  @order_promotions ||= ::Io::Flow::V0::Clients::OrderPromotions.new(self)
end

#ordersObject



95
96
97
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 95

def orders
  @orders ||= ::Io::Flow::V0::Clients::Orders.new(self)
end

#organization_authorizationsObject



367
368
369
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 367

def organization_authorizations
  @organization_authorizations ||= ::Io::Flow::V0::Clients::OrganizationAuthorizations.new(self)
end

#organization_currency_settingsObject



143
144
145
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 143

def organization_currency_settings
  @organization_currency_settings ||= ::Io::Flow::V0::Clients::OrganizationCurrencySettings.new(self)
end

#organization_tokensObject



371
372
373
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 371

def organization_tokens
  @organization_tokens ||= ::Io::Flow::V0::Clients::OrganizationTokens.new(self)
end

#organizationsObject



111
112
113
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 111

def organizations
  @organizations ||= ::Io::Flow::V0::Clients::Organizations.new(self)
end

#partner_tokensObject



375
376
377
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 375

def partner_tokens
  @partner_tokens ||= ::Io::Flow::V0::Clients::PartnerTokens.new(self)
end

#password_reset_formsObject



379
380
381
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 379

def password_reset_forms
  @password_reset_forms ||= ::Io::Flow::V0::Clients::PasswordResetForms.new(self)
end

#payment_method_rulesObject



115
116
117
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 115

def payment_method_rules
  @payment_method_rules ||= ::Io::Flow::V0::Clients::PaymentMethodRules.new(self)
end

#payment_methodsObject



319
320
321
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 319

def payment_methods
  @payment_methods ||= ::Io::Flow::V0::Clients::PaymentMethods.new(self)
end

#paymentsObject



199
200
201
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 199

def payments
  @payments ||= ::Io::Flow::V0::Clients::Payments.new(self)
end

#provincesObject



323
324
325
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 323

def provinces
  @provinces ||= ::Io::Flow::V0::Clients::Provinces.new(self)
end

#public_keysObject



203
204
205
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 203

def public_keys
  @public_keys ||= ::Io::Flow::V0::Clients::PublicKeys.new(self)
end

#queriesObject



119
120
121
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 119

def queries
  @queries ||= ::Io::Flow::V0::Clients::Queries.new(self)
end

#quotesObject



239
240
241
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 239

def quotes
  @quotes ||= ::Io::Flow::V0::Clients::Quotes.new(self)
end

#ratesObject



147
148
149
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 147

def rates
  @rates ||= ::Io::Flow::V0::Clients::Rates.new(self)
end

#refundsObject



207
208
209
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 207

def refunds
  @refunds ||= ::Io::Flow::V0::Clients::Refunds.new(self)
end

#regionsObject



327
328
329
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 327

def regions
  @regions ||= ::Io::Flow::V0::Clients::Regions.new(self)
end

#request(path = nil) ⇒ Object



52
53
54
55
56
57
58
59
60
61
62
63
64
65
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 52

def request(path=nil)
  HttpClient::Preconditions.assert_class_or_nil('path', path, String)
  request = HttpClient::Request.new(@http_handler, @base_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

#returnsObject



243
244
245
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 243

def returns
  @returns ||= ::Io::Flow::V0::Clients::Returns.new(self)
end

#reversalsObject



211
212
213
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 211

def reversals
  @reversals ||= ::Io::Flow::V0::Clients::Reversals.new(self)
end

#scheduled_exportsObject



383
384
385
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 383

def scheduled_exports
  @scheduled_exports ||= ::Io::Flow::V0::Clients::ScheduledExports.new(self)
end

#session_authorizationsObject



391
392
393
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 391

def session_authorizations
  @session_authorizations ||= ::Io::Flow::V0::Clients::SessionAuthorizations.new(self)
end

#sessionsObject



387
388
389
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 387

def sessions
  @sessions ||= ::Io::Flow::V0::Clients::Sessions.new(self)
end

#shipping_labelsObject



247
248
249
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 247

def shipping_labels
  @shipping_labels ||= ::Io::Flow::V0::Clients::ShippingLabels.new(self)
end

#shipping_notificationsObject



251
252
253
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 251

def shipping_notifications
  @shipping_notifications ||= ::Io::Flow::V0::Clients::ShippingNotifications.new(self)
end

#subcatalog_itemsObject



127
128
129
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 127

def subcatalog_items
  @subcatalog_items ||= ::Io::Flow::V0::Clients::SubcatalogItems.new(self)
end

#subcatalogsObject



123
124
125
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 123

def subcatalogs
  @subcatalogs ||= ::Io::Flow::V0::Clients::Subcatalogs.new(self)
end

#suggestionsObject



395
396
397
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 395

def suggestions
  @suggestions ||= ::Io::Flow::V0::Clients::Suggestions.new(self)
end

#targeting_itemsObject



135
136
137
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 135

def targeting_items
  @targeting_items ||= ::Io::Flow::V0::Clients::TargetingItems.new(self)
end

#targetingsObject



131
132
133
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 131

def targetings
  @targetings ||= ::Io::Flow::V0::Clients::Targetings.new(self)
end

#tariff_codesObject



183
184
185
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 183

def tariff_codes
  @tariff_codes ||= ::Io::Flow::V0::Clients::TariffCodes.new(self)
end

#tier_defaultsObject



259
260
261
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 259

def tier_defaults
  @tier_defaults ||= ::Io::Flow::V0::Clients::TierDefaults.new(self)
end

#tier_rulesObject



263
264
265
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 263

def tier_rules
  @tier_rules ||= ::Io::Flow::V0::Clients::TierRules.new(self)
end

#tiersObject



255
256
257
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 255

def tiers
  @tiers ||= ::Io::Flow::V0::Clients::Tiers.new(self)
end

#timezonesObject



299
300
301
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 299

def timezones
  @timezones ||= ::Io::Flow::V0::Clients::Timezones.new(self)
end

#token_validationsObject



403
404
405
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 403

def token_validations
  @token_validations ||= ::Io::Flow::V0::Clients::TokenValidations.new(self)
end

#tokensObject



399
400
401
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 399

def tokens
  @tokens ||= ::Io::Flow::V0::Clients::Tokens.new(self)
end

#tracking_eventsObject



271
272
273
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 271

def tracking_events
  @tracking_events ||= ::Io::Flow::V0::Clients::TrackingEvents.new(self)
end

#tracking_labelsObject



275
276
277
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 275

def tracking_labels
  @tracking_labels ||= ::Io::Flow::V0::Clients::TrackingLabels.new(self)
end

#trackingsObject



267
268
269
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 267

def trackings
  @trackings ||= ::Io::Flow::V0::Clients::Trackings.new(self)
end

#transit_windowsObject



279
280
281
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 279

def transit_windows
  @transit_windows ||= ::Io::Flow::V0::Clients::TransitWindows.new(self)
end

#uploadsObject



407
408
409
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 407

def uploads
  @uploads ||= ::Io::Flow::V0::Clients::Uploads.new(self)
end

#usersObject



411
412
413
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 411

def users
  @users ||= ::Io::Flow::V0::Clients::Users.new(self)
end

#webhook_deliveriesObject



287
288
289
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 287

def webhook_deliveries
  @webhook_deliveries ||= ::Io::Flow::V0::Clients::WebhookDeliveries.new(self)
end

#webhooksObject



283
284
285
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 283

def webhooks
  @webhooks ||= ::Io::Flow::V0::Clients::Webhooks.new(self)
end