Class: Ipizza::Request

Inherits:
Object
  • Object
show all
Defined in:
lib/ipizza/request.rb

Direct Known Subclasses

AuthenticationRequest, PaymentRequest

Constant Summary collapse

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

Instance Method Summary collapse

Instance Attribute Details

#extra_paramsObject

Returns the value of attribute extra_params.



4
5
6
# File 'lib/ipizza/request.rb', line 4

def extra_params
  @extra_params
end

#service_urlObject

Returns the value of attribute service_url.



6
7
8
# File 'lib/ipizza/request.rb', line 6

def service_url
  @service_url
end

#sign_paramsObject

Returns the value of attribute sign_params.



5
6
7
# File 'lib/ipizza/request.rb', line 5

def sign_params
  @sign_params
end

Instance Method Details

#request_paramsObject



20
21
22
# File 'lib/ipizza/request.rb', line 20

def request_params
  sign_params.merge(extra_params)
end

#sign(privkey_path, privkey_secret, order, mac_param = 'VK_MAC') ⇒ Object



15
16
17
18
# File 'lib/ipizza/request.rb', line 15

def sign(privkey_path, privkey_secret, order, mac_param = 'VK_MAC')
  signature = Ipizza::Util.sign(privkey_path, privkey_secret, Ipizza::Util.mac_data_string(sign_params, order))
  self.sign_params[mac_param] = signature
end