Class: FlexOps::Client

Inherits:
Object
  • Object
show all
Defined in:
lib/flexops/client.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(api_key: nil, access_token: nil, base_url: "https://gateway.flexops.io", workspace_id: nil, timeout: 30) ⇒ Client

Returns a new instance of Client.



17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
# File 'lib/flexops/client.rb', line 17

def initialize(api_key: nil, access_token: nil, base_url: "https://gateway.flexops.io", workspace_id: nil, timeout: 30)
  @http = HttpClient.new(base_url: base_url, api_key: api_key, access_token: access_token, timeout: timeout)
  @workspace_id = workspace_id

  ws_id_proc = -> { @workspace_id }

  @auth = Resources::Auth.new(@http)
  @workspaces = Resources::Workspaces.new(@http, ws_id_proc)
  @shipping = Resources::Shipping.new(@http, ws_id_proc)
  @carriers = Resources::Carriers.new(@http)
  @webhooks = Resources::Webhooks.new(@http, ws_id_proc)
  @wallet = Resources::Wallet.new(@http, ws_id_proc)
  @insurance = Resources::Insurance.new(@http, ws_id_proc)
  @returns = Resources::Returns.new(@http, ws_id_proc)
  @api_keys = Resources::ApiKeys.new(@http, ws_id_proc)
  @analytics = Resources::Analytics.new(@http)
  @orders = Resources::Orders.new(@http)
  @inventory = Resources::Inventory.new(@http)
  @pickups = Resources::Pickups.new(@http, ws_id_proc)
  @scan_forms = Resources::ScanForms.new(@http, ws_id_proc)
  @rules = Resources::Rules.new(@http, ws_id_proc)
  @offsets = Resources::Offsets.new(@http, ws_id_proc)
  @hs_codes = Resources::HsCodes.new(@http, ws_id_proc)
  @recurring_shipments = Resources::RecurringShipments.new(@http, ws_id_proc)
  @email_templates = Resources::EmailTemplates.new(@http, ws_id_proc)
  @reports = Resources::Reports.new(@http, ws_id_proc)
end

Instance Attribute Details

#analyticsObject (readonly)

Returns the value of attribute analytics.



12
13
14
# File 'lib/flexops/client.rb', line 12

def analytics
  @analytics
end

#api_keysObject (readonly)

Returns the value of attribute api_keys.



12
13
14
# File 'lib/flexops/client.rb', line 12

def api_keys
  @api_keys
end

#authObject (readonly)

Returns the value of attribute auth.



12
13
14
# File 'lib/flexops/client.rb', line 12

def auth
  @auth
end

#carriersObject (readonly)

Returns the value of attribute carriers.



12
13
14
# File 'lib/flexops/client.rb', line 12

def carriers
  @carriers
end

#email_templatesObject (readonly)

Returns the value of attribute email_templates.



12
13
14
# File 'lib/flexops/client.rb', line 12

def email_templates
  @email_templates
end

#hs_codesObject (readonly)

Returns the value of attribute hs_codes.



12
13
14
# File 'lib/flexops/client.rb', line 12

def hs_codes
  @hs_codes
end

#insuranceObject (readonly)

Returns the value of attribute insurance.



12
13
14
# File 'lib/flexops/client.rb', line 12

def insurance
  @insurance
end

#inventoryObject (readonly)

Returns the value of attribute inventory.



12
13
14
# File 'lib/flexops/client.rb', line 12

def inventory
  @inventory
end

#offsetsObject (readonly)

Returns the value of attribute offsets.



12
13
14
# File 'lib/flexops/client.rb', line 12

def offsets
  @offsets
end

#ordersObject (readonly)

Returns the value of attribute orders.



12
13
14
# File 'lib/flexops/client.rb', line 12

def orders
  @orders
end

#pickupsObject (readonly)

Returns the value of attribute pickups.



12
13
14
# File 'lib/flexops/client.rb', line 12

def pickups
  @pickups
end

#recurring_shipmentsObject (readonly)

Returns the value of attribute recurring_shipments.



12
13
14
# File 'lib/flexops/client.rb', line 12

def recurring_shipments
  @recurring_shipments
end

#reportsObject (readonly)

Returns the value of attribute reports.



12
13
14
# File 'lib/flexops/client.rb', line 12

def reports
  @reports
end

#returnsObject (readonly)

Returns the value of attribute returns.



12
13
14
# File 'lib/flexops/client.rb', line 12

def returns
  @returns
end

#rulesObject (readonly)

Returns the value of attribute rules.



12
13
14
# File 'lib/flexops/client.rb', line 12

def rules
  @rules
end

#scan_formsObject (readonly)

Returns the value of attribute scan_forms.



12
13
14
# File 'lib/flexops/client.rb', line 12

def scan_forms
  @scan_forms
end

#shippingObject (readonly)

Returns the value of attribute shipping.



12
13
14
# File 'lib/flexops/client.rb', line 12

def shipping
  @shipping
end

#walletObject (readonly)

Returns the value of attribute wallet.



12
13
14
# File 'lib/flexops/client.rb', line 12

def wallet
  @wallet
end

#webhooksObject (readonly)

Returns the value of attribute webhooks.



12
13
14
# File 'lib/flexops/client.rb', line 12

def webhooks
  @webhooks
end

#workspace_idObject

Returns the value of attribute workspace_id.



11
12
13
# File 'lib/flexops/client.rb', line 11

def workspace_id
  @workspace_id
end

#workspacesObject (readonly)

Returns the value of attribute workspaces.



12
13
14
# File 'lib/flexops/client.rb', line 12

def workspaces
  @workspaces
end

Instance Method Details

#set_access_token(token) ⇒ Object



45
46
47
# File 'lib/flexops/client.rb', line 45

def set_access_token(token)
  @http.set_access_token(token)
end

#set_api_key(key) ⇒ Object



49
50
51
# File 'lib/flexops/client.rb', line 49

def set_api_key(key)
  @http.set_api_key(key)
end