Class: Button::Customers

Inherits:
Resource show all
Defined in:
lib/button/resources/customers.rb

Overview

Constant Summary

Constants inherited from Resource

Resource::USER_AGENT

Instance Attribute Summary

Attributes inherited from Resource

#config

Instance Method Summary collapse

Methods inherited from Resource

#api_delete, #api_get, #api_post, #initialize, #timeout

Constructor Details

This class inherits a constructor from Button::Resource

Instance Method Details

#create(customer) ⇒ Button::Response

Create a Customer

Parameters:

  • customer (Hash)

    the customer to create

Returns:



26
27
28
# File 'lib/button/resources/customers.rb', line 26

def create(customer)
  api_post(path, customer)
end

#get(customer_id) ⇒ Button::Response

Gets a customer

Parameters:

  • customer_id (String)

    the customer id

Returns:



17
18
19
# File 'lib/button/resources/customers.rb', line 17

def get(customer_id)
  api_get(path(customer_id))
end

#path(customer_id = nil) ⇒ Object



7
8
9
10
# File 'lib/button/resources/customers.rb', line 7

def path(customer_id = nil)
  return "/v1/customers/#{customer_id}" if customer_id
  '/v1/customers'
end