Class: RubyPsigate::AccountManagerApi
- Inherits:
-
Object
- Object
- RubyPsigate::AccountManagerApi
- Includes:
- Utils
- Defined in:
- lib/ruby_psigate/account_manager_api.rb
Constant Summary collapse
- TEST_URL =
'https://dev.psigate.com:8645/Messenger/AMMessenger'
- LIVE_URL =
TODO
nil
Instance Attribute Summary collapse
-
#action ⇒ Object
readonly
Returns the value of attribute action.
-
#test ⇒ Object
Returns the value of attribute test.
Instance Method Summary collapse
- #charge(options = {}) ⇒ Object
- #disable(options = {}) ⇒ Object
- #enable(options = {}) ⇒ Object
-
#initialize(options = {}) ⇒ AccountManagerApi
constructor
A new instance of AccountManagerApi.
-
#register(options = {}) ⇒ Object
Registers a new account.
-
#retrieve_summary(options = {}) ⇒ Object
Retrieves a summary of a registered account.
- #test? ⇒ Boolean
-
#update(options = {}) ⇒ Object
Updates an already registered account.
Methods included from Utils
Constructor Details
#initialize(options = {}) ⇒ AccountManagerApi
Returns a new instance of AccountManagerApi.
12 13 14 15 16 |
# File 'lib/ruby_psigate/account_manager_api.rb', line 12 def initialize( = {}) requires!(, :cid, :login, :password) @options = @live_url = @options[:live_url] end |
Instance Attribute Details
#action ⇒ Object (readonly)
Returns the value of attribute action.
9 10 11 |
# File 'lib/ruby_psigate/account_manager_api.rb', line 9 def action @action end |
#test ⇒ Object
Returns the value of attribute test.
10 11 12 |
# File 'lib/ruby_psigate/account_manager_api.rb', line 10 def test @test end |
Instance Method Details
#charge(options = {}) ⇒ Object
97 98 99 |
# File 'lib/ruby_psigate/account_manager_api.rb', line 97 def charge( = {}) end |
#disable(options = {}) ⇒ Object
93 94 95 |
# File 'lib/ruby_psigate/account_manager_api.rb', line 93 def disable( = {}) @action = "AMA09" end |
#enable(options = {}) ⇒ Object
89 90 91 |
# File 'lib/ruby_psigate/account_manager_api.rb', line 89 def enable( = {}) @action = "AMA08" end |
#register(options = {}) ⇒ Object
Registers a new account
Options (* asterisk denotes required)
> :name*
> :company
> :address1*
> :address2
> :city*
> :province*
> :postal_code*
> :country*
> :phone*
> :fax
> :email*
> :comments
> :card_holder*
> :card_number*
> :card_exp_month*
> :card_exp_year*
42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 |
# File 'lib/ruby_psigate/account_manager_api.rb', line 42 def register( = {}) requires!(, :name, :address1, :city, :province, :postal_code, :country, :phone, :email, :card_holder, :card_number, :card_exp_month, :card_exp_year ) @register_options = @action = "AMA01" end |
#retrieve_summary(options = {}) ⇒ Object
Retrieves a summary of a registered account
67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 |
# File 'lib/ruby_psigate/account_manager_api.rb', line 67 def retrieve_summary( = {}) requires!(, :account_id) @options.update() @action = "AMA00" @params = { :Request => { :CID => @options[:cid], :UserID => @options[:login], :Password => @options[:password], :Action => @action, :Condition => { :AccountID => @options[:account_id] } } } @data = data_to_be_posted(@params) raw_response = post_to_server(@data) response = Response.new(successful?(raw_response), (raw_response), raw_response, :test => test?) end |
#test? ⇒ Boolean
18 19 20 |
# File 'lib/ruby_psigate/account_manager_api.rb', line 18 def test? @live_url.blank? end |
#update(options = {}) ⇒ Object
Updates an already registered account
62 63 64 |
# File 'lib/ruby_psigate/account_manager_api.rb', line 62 def update( = {}) @action = "AMA02" end |