Class: SimplePin::Pin
Defined Under Namespace
Classes: PinError
Instance Attribute Summary collapse
-
#auth ⇒ Object
Returns the value of attribute auth.
-
#base_url ⇒ Object
Returns the value of attribute base_url.
Instance Method Summary collapse
-
#create_card(options = {}) ⇒ Object
Creates a card given a hash of options pin.net.au/docs/api/cards returns: a card object.
-
#create_charge(options = {}) ⇒ Object
Create a charge given charge details and a card, pin.net.au/docs/api/charges returns: a charge object.
-
#create_customer(options = {}) ⇒ Object
Create a customer given customer details and a card_token pin.net.au/docs/api/customers returns: a customer object.
-
#initialize(key = '', env = :test) ⇒ Pin
constructor
Create a new Pin instance key: Your Pin secret key env: The environment you want to use.
Constructor Details
#initialize(key = '', env = :test) ⇒ Pin
Create a new Pin instance
key: Your Pin secret key
env: The environment you want to use.
12 13 14 15 16 17 18 19 20 21 |
# File 'lib/simple_pin.rb', line 12 def initialize(key = '', env = :test) @key = key env = env.to_sym @auth = { username: @key, password: '' } @base_url = if env == :live 'https://api.pin.net.au/1/' else 'https://test-api.pin.net.au/1/' end end |
Instance Attribute Details
#auth ⇒ Object
Returns the value of attribute auth.
6 7 8 |
# File 'lib/simple_pin.rb', line 6 def auth @auth end |
#base_url ⇒ Object
Returns the value of attribute base_url.
6 7 8 |
# File 'lib/simple_pin.rb', line 6 def base_url @base_url end |
Instance Method Details
#create_card(options = {}) ⇒ Object
Creates a card given a hash of options pin.net.au/docs/api/cards returns: a card object
43 44 45 |
# File 'lib/simple_pin.rb', line 43 def create_card( = {}) build_response(make_request(:post, url: 'cards', options: )) end |
#create_charge(options = {}) ⇒ Object
Create a charge given charge details and a card, pin.net.au/docs/api/charges returns: a charge object
34 35 36 |
# File 'lib/simple_pin.rb', line 34 def create_charge( = {}) build_response(make_request(:post, url: 'charges', options: )) end |
#create_customer(options = {}) ⇒ Object
Create a customer given customer details and a card_token pin.net.au/docs/api/customers returns: a customer object
52 53 54 |
# File 'lib/simple_pin.rb', line 52 def create_customer( = {}) build_response(make_request(:post, url: 'customers', options: )) end |