Class: EasyPing::Charge
Constant Summary collapse
- REQUIRED =
[ 'order_no', 'app[id]', 'channel', 'amount', 'client_ip', 'currency', 'subject', 'body' ]
Constants inherited from Action
Instance Attribute Summary
Attributes inherited from Action
Class Method Summary collapse
Instance Method Summary collapse
- #all(params = {}) ⇒ Object
- #charge(*args) ⇒ Object
- #find(*args) ⇒ Object
-
#initialize(config) ⇒ Charge
constructor
A new instance of Charge.
Methods inherited from Action
Methods included from Utils
#indifferent_hash, #indifferent_params
Constructor Details
#initialize(config) ⇒ Charge
Returns a new instance of Charge.
140 141 142 143 |
# File 'lib/easy_ping/action.rb', line 140 def initialize(config) super(config) @settings = config..merge end |
Class Method Details
Instance Method Details
#all(params = {}) ⇒ Object
165 166 167 168 169 170 171 172 173 |
# File 'lib/easy_ping/action.rb', line 165 def all(params={}) params = indifferent_hash params # map keys to API request format params = compile params raw_response = client.run :get, api_endpoint, params EasyPing::Model::Wrapper.parse! raw_response, config end |
#charge(*args) ⇒ Object
145 146 147 148 149 150 151 152 153 154 155 156 |
# File 'lib/easy_ping/action.rb', line 145 def charge(*args) params = indifferent_params(args, 'order_number', 'amount', 'subject', 'body') params = @settings.merge params # map keys to API request format and verify params params = compile params verify! params, charge_requires # run request and parse return result raw_response = client.run(:post, api_endpoint, params) EasyPing::Model::Wrapper.parse! raw_response, config end |