Class: Ipizza::Response
- Inherits:
-
Object
- Object
- Ipizza::Response
- Defined in:
- lib/ipizza/response.rb
Direct Known Subclasses
Constant Summary collapse
- @@response_param_order =
{ '1101' => ['VK_SERVICE', 'VK_VERSION', 'VK_SND_ID', 'VK_REC_ID', 'VK_STAMP', 'VK_T_NO', 'VK_AMOUNT', 'VK_CURR', 'VK_REC_ACC', 'VK_REC_NAME', 'VK_SND_ACC', 'VK_SND_NAME', 'VK_REF', 'VK_MSG', 'VK_T_DATE'], '3002' => ['VK_SERVICE', 'VK_VERSION', 'VK_USER', 'VK_DATE', 'VK_TIME', 'VK_SND_ID', 'VK_INFO'], '1901' => ['VK_SERVICE', 'VK_VERSION', 'VK_SND_ID', 'VK_REC_ID', 'VK_STAMP', 'VK_REF', 'VK_MSG'], '1902' => ['VK_SERVICE', 'VK_VERSION', 'VK_SND_ID', 'VK_REC_ID', 'VK_STAMP', 'VK_REF', 'VK_MSG', 'VK_ERROR_CODE'] }
Instance Attribute Summary collapse
-
#verify_params ⇒ Object
Returns the value of attribute verify_params.
-
#verify_params_order ⇒ Object
Returns the value of attribute verify_params_order.
Instance Method Summary collapse
-
#initialize(params) ⇒ Response
constructor
A new instance of Response.
- #verify(certificate_path, charset = 'UTF-8') ⇒ Object
Constructor Details
#initialize(params) ⇒ Response
Returns a new instance of Response.
13 14 15 |
# File 'lib/ipizza/response.rb', line 13 def initialize(params) @params = params end |
Instance Attribute Details
#verify_params ⇒ Object
Returns the value of attribute verify_params.
3 4 5 |
# File 'lib/ipizza/response.rb', line 3 def verify_params @verify_params end |
#verify_params_order ⇒ Object
Returns the value of attribute verify_params_order.
4 5 6 |
# File 'lib/ipizza/response.rb', line 4 def verify_params_order @verify_params_order end |
Instance Method Details
#verify(certificate_path, charset = 'UTF-8') ⇒ Object
17 18 19 20 21 22 23 |
# File 'lib/ipizza/response.rb', line 17 def verify(certificate_path, charset = 'UTF-8') param_order = @@response_param_order[@params['VK_SERVICE']] verify_params = param_order.inject(Hash.new) { |h, p| h[p] = @params[p]; h } mac_string = Ipizza::Util.mac_data_string(verify_params, param_order) @valid = Ipizza::Util.verify_signature(certificate_path, @params['VK_MAC'], mac_string) end |