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

#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.



45
46
47
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 45

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

Instance Method Details

#addressesObject



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

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

#attributesObject



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

#authorizationsObject



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

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

#capturesObject



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

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

#cardsObject



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

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

#carriersObject



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

def carriers
  @carriers ||= ::Io::Flow::V0::Clients::Carriers.new(self)
end

#catalogsObject



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

#centersObject



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

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

#countriesObject



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

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

#country_defaultsObject



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

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

#currenciesObject



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

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

#delivery_windowsObject



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

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

#documentsObject



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

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

#email_verificationsObject



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

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

#experience_defaultsObject



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

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

#experiencesObject



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

#exportsObject



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

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

#harmonization_settingsObject



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_categoriesObject



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_dutiesObject



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_itemsObject



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_costsObject



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

#healthchecksObject



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

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

#hs10Object



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

#hs6Object



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

#importsObject



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

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

#inventory_rulesObject



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

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

#inventory_snapshotsObject



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

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

#inventory_updatesObject



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

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

#invitationsObject



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_functionsObject



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

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

#itemsObject



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

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

#languagesObject



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

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

#membershipsObject



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_estimatesObject



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

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

#ordersObject



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

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

#organization_authorizationsObject



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

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

#organization_currency_settingsObject



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

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

#organization_tokensObject



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

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

#organizationsObject



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

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

#partner_tokensObject



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

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

#password_reset_formsObject



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

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

#public_keysObject



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

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

#queriesObject



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

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

#quote_estimatesObject



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

def quote_estimates
  @quote_estimates ||= ::Io::Flow::V0::Clients::QuoteEstimates.new(self)
end

#quotesObject



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

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

#ratesObject



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

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

#refundsObject



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

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

#regionsObject



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

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

#servicesObject



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

def services
  @services ||= ::Io::Flow::V0::Clients::Services.new(self)
end

#shipping_labelsObject



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

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

#shipping_notificationsObject



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

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

#spot_ratesObject



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

def spot_rates
  @spot_rates ||= ::Io::Flow::V0::Clients::SpotRates.new(self)
end

#subcatalog_itemsObject



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

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

#subcatalogsObject



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

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

#suggestionsObject



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

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

#targeting_itemsObject



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

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

#targetingsObject



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

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

#tier_defaultsObject



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

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

#tier_rulesObject



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

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

#tiersObject



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

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

#timezonesObject



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

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

#token_validationsObject



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

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

#tokensObject



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

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

#tracking_eventsObject



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

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

#tracking_labelsObject



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

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

#trackingsObject



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

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

#uploadsObject



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

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

#usersObject



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

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

#webhook_deliveriesObject



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

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

#webhooksObject



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

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