Class: PortaText::Command::Api::CreditCards

Inherits:
Base
  • Object
show all
Defined in:
lib/portatext/command/api/credit_cards.rb

Overview

The credit_cards/:id endpoint. github.com/PortaText/docs/wiki/REST-API#api_credit_cards

Author

Marcelo Gornstein ([email protected])

Copyright

Copyright © 2015 PortaText

License

Apache-2.0

Instance Attribute Summary

Attributes inherited from Base

#client

Instance Method Summary collapse

Methods inherited from Base

#accept_content_type, #body, #content_type, #delete, #get, #initialize, #patch, #post, #put, #set

Constructor Details

This class inherits a constructor from PortaText::Command::Base

Instance Method Details

#address(street_address, city, state, zip, country) ⇒ Object



26
27
28
29
30
31
32
# File 'lib/portatext/command/api/credit_cards.rb', line 26

def address(street_address, city, state, zip, country)
  set :address, street_address
  set :city, city
  set :state, state
  set :zip, zip
  set :country, country
end

#card_info(number, expiration_date, code) ⇒ Object



20
21
22
23
24
# File 'lib/portatext/command/api/credit_cards.rb', line 20

def card_info(number, expiration_date, code)
  set :card_number, number
  set :card_expiration_date, expiration_date
  set :card_code, code
end

#endpoint(_method) ⇒ Object



34
35
36
37
38
39
# File 'lib/portatext/command/api/credit_cards.rb', line 34

def endpoint(_method)
  return 'credit_cards' if @args[:id].nil?
  id = @args[:id]
  @args.delete :id
  "credit_cards/#{id}"
end

#id(id) ⇒ Object



11
12
13
# File 'lib/portatext/command/api/credit_cards.rb', line 11

def id(id)
  set :id, id
end

#name_on_card(first, last) ⇒ Object



15
16
17
18
# File 'lib/portatext/command/api/credit_cards.rb', line 15

def name_on_card(first, last)
  set :first_name, first
  set :last_name, last
end