Class: Ipizza::Request
- Inherits:
-
Object
- Object
- Ipizza::Request
- Defined in:
- lib/ipizza/request.rb
Direct Known Subclasses
Constant Summary collapse
- DEFAULT_MAC_PARAM =
'VK_MAC'- PARAM_ORDER =
{ '1011' => %w(VK_SERVICE VK_VERSION VK_SND_ID VK_STAMP VK_AMOUNT VK_CURR VK_ACC VK_NAME VK_REF VK_MSG VK_RETURN VK_CANCEL VK_DATETIME), '1012' => %w(VK_SERVICE VK_VERSION VK_SND_ID VK_STAMP VK_AMOUNT VK_CURR VK_REF VK_MSG VK_RETURN VK_CANCEL VK_DATETIME), '4011' => %w(VK_SERVICE VK_VERSION VK_SND_ID VK_REPLY VK_RETURN VK_DATETIME VK_RID), '4012' => %w(VK_SERVICE VK_VERSION VK_SND_ID VK_REC_ID VK_NONCE VK_RETURN VK_DATETIME VK_RID) }
Instance Attribute Summary collapse
-
#extra_params ⇒ Object
Returns the value of attribute extra_params.
-
#service_url ⇒ Object
Returns the value of attribute service_url.
-
#sign_params ⇒ Object
Returns the value of attribute sign_params.
Instance Method Summary collapse
- #request_params ⇒ Object
- #sign(privkey_path, privkey_secret, order, mac_param = nil, hash_algorithm = nil) ⇒ Object
Instance Attribute Details
#extra_params ⇒ Object
Returns the value of attribute extra_params.
6 7 8 |
# File 'lib/ipizza/request.rb', line 6 def extra_params @extra_params end |
#service_url ⇒ Object
Returns the value of attribute service_url.
8 9 10 |
# File 'lib/ipizza/request.rb', line 8 def service_url @service_url end |
#sign_params ⇒ Object
Returns the value of attribute sign_params.
7 8 9 |
# File 'lib/ipizza/request.rb', line 7 def sign_params @sign_params end |
Instance Method Details
#request_params ⇒ Object
27 28 29 |
# File 'lib/ipizza/request.rb', line 27 def request_params sign_params.merge(extra_params) end |
#sign(privkey_path, privkey_secret, order, mac_param = nil, hash_algorithm = nil) ⇒ Object
17 18 19 20 21 22 23 24 25 |
# File 'lib/ipizza/request.rb', line 17 def sign(privkey_path, privkey_secret, order, mac_param = nil, hash_algorithm = nil) signature = Ipizza::Util.sign( privkey_path, privkey_secret, Ipizza::Util.mac_data_string(sign_params, order), hash_algorithm || Ipizza::Util::DEFAULT_HASH_ALGORITHM ) self.sign_params[mac_param || DEFAULT_MAC_PARAM] = signature end |