Class: PactasItero::Client

Inherits:
Object
  • Object
show all
Includes:
Api, Configurable
Defined in:
lib/pactas_itero/client.rb

Constant Summary collapse

"X-SELECTED-LEGAL-ENTITY-ID"

Instance Attribute Summary collapse

Attributes included from Configurable

#api_endpoint, #client_id, #client_secret, #default_media_type, #legal_entity_id, #middleware, #production, #user_agent

Instance Method Summary collapse

Methods included from Api::PaymentTransactions

#payment_transaction

Methods included from Api::Invoices

#invoice, #invoice_download, #invoices, #invoices_from

Methods included from Api::Orders

#commit_order, #create_order, #order

Methods included from Api::Contracts

#contract, #contract_cancellation_preview, #contract_changes, #contract_metered_usage, #contracts, #customer_contracts, #get_self_service_token_for_contract, #terminate_contract, #update_contract

Methods included from Api::Customers

#create_customer, #customer, #customers, #update_customer

Methods included from Api::RatedItems

#create_rated_item, #delete_rated_item, #rated_items

Methods included from Api::OAuth

#token

Methods included from Configurable

#configure, keys, #production_api_endpoint, #reset!, #sandbox_api_endpoint

Constructor Details

#initialize(options = {}) ⇒ Client

Returns a new instance of Client.



17
18
19
20
21
22
23
24
# File 'lib/pactas_itero/client.rb', line 17

def initialize(options = {})
  PactasItero::Configurable.keys.each do |key|
    instance_variable_set(
      :"@#{key}",
      options[key] || PactasItero.instance_variable_get(:"@#{key}")
    )
  end
end

Instance Attribute Details

#bearer_tokenObject

Returns the value of attribute bearer_token.



15
16
17
# File 'lib/pactas_itero/client.rb', line 15

def bearer_token
  @bearer_token
end

Instance Method Details

#bearer_token?Boolean

Returns:

  • (Boolean)


50
51
52
# File 'lib/pactas_itero/client.rb', line 50

def bearer_token?
  !!bearer_token
end

#delete(url, options = {}) ⇒ Object



42
43
44
# File 'lib/pactas_itero/client.rb', line 42

def delete(url, options = {})
  request :delete, url, options
end

#get(url, options = {}) ⇒ Object



26
27
28
# File 'lib/pactas_itero/client.rb', line 26

def get(url, options = {})
  request :get, url, options
end

#head(url, options = {}) ⇒ Object



46
47
48
# File 'lib/pactas_itero/client.rb', line 46

def head(url, options = {})
  request :head, url, options
end

#patch(url, options = {}) ⇒ Object



38
39
40
# File 'lib/pactas_itero/client.rb', line 38

def patch(url, options = {})
  request :patch, url, options
end

#post(url, options = {}) ⇒ Object



30
31
32
# File 'lib/pactas_itero/client.rb', line 30

def post(url, options = {})
  request :post, url, options
end

#put(url, options = {}) ⇒ Object



34
35
36
# File 'lib/pactas_itero/client.rb', line 34

def put(url, options = {})
  request :put, url, options
end