Class: Monri::Customers
- Inherits:
-
Object
- Object
- Monri::Customers
- Defined in:
- lib/monri/customers.rb,
lib/monri/customers/create_response.rb
Defined Under Namespace
Classes: CreateResponse
Instance Attribute Summary collapse
- #access_tokens ⇒ Monri::AccessTokens writeonly
- #config ⇒ Monri::Config
- #http_client ⇒ Monri::HttpClient writeonly
Instance Method Summary collapse
Instance Attribute Details
#access_tokens=(value) ⇒ Monri::AccessTokens (writeonly)
8 9 10 |
# File 'lib/monri/customers.rb', line 8 def access_tokens=(value) @access_tokens = value end |
#http_client=(value) ⇒ Monri::HttpClient (writeonly)
6 7 8 |
# File 'lib/monri/customers.rb', line 6 def http_client=(value) @http_client = value end |
Instance Method Details
#create(options) ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/monri/customers.rb', line 11 def create() CreateResponse.create do token_rv = @access_tokens.create!(scopes: ['customers']) response = @http_client.post('/v2/customers', , oauth: token_rv.access_token) if response.failed? raise response.exception elsif response.success? response.body else # TODO: handle this case end end end |