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



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

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



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

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

#capturesObject



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

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

#cardsObject



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

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



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

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

#countriesObject



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

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

#country_defaultsObject



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

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

#currenciesObject



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

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

#delivery_windowsObject



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

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

#documentsObject



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

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

#email_verificationsObject



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

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

#experience_defaultsObject



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

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

#experiencesObject



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

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

#exportsObject



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

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

#harmonization_settingsObject



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

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

#harmonized_categoriesObject



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

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

#harmonized_item_dutiesObject



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

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

#harmonized_itemsObject



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

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

#harmonized_landed_costsObject



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

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

#healthchecksObject



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

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

#hs10Object



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

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

#hs6Object



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

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

#hs_codesObject



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

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

#importsObject



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

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

#inventory_rulesObject



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

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

#inventory_snapshotsObject



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

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

#inventory_updatesObject



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

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

#invitationsObject



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

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

#item_functionsObject



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

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

#itemsObject



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

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

#languagesObject



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

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

#localesObject



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

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

#membershipsObject



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

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

#order_estimatesObject



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

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

#order_identifiersObject



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

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

#ordersObject



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

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

#organization_authorizationsObject



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

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

#organization_currency_settingsObject



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

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

#organization_tokensObject



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

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

#organizationsObject



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

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

#partner_tokensObject



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

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

#password_reset_formsObject



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

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

#paymentsObject



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

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

#public_keysObject



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

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

#queriesObject



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

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

#quotesObject



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

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

#ratesObject



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

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

#refundsObject



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

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

#regionsObject



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

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



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

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

#scheduled_exportsObject



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

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

#session_authorizationsObject



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

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

#sessionsObject



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

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

#shipping_labelsObject



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

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

#shipping_notificationsObject



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

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

#subcatalog_itemsObject



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

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

#subcatalogsObject



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

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

#suggestionsObject



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

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

#targeting_itemsObject



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

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

#targetingsObject



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

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

#tier_defaultsObject



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

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

#tier_rulesObject



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

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

#tiersObject



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

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

#timezonesObject



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

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

#token_validationsObject



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

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

#tokensObject



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

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

#tracking_eventsObject



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

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

#tracking_labelsObject



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

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

#trackingsObject



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

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

#uploadsObject



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

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

#usersObject



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

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

#webhook_deliveriesObject



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

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

#webhooksObject



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

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