Class: Paypal::NVP::Request

Inherits:
Base
  • Object
show all
Defined in:
lib/paypal/nvp/request.rb

Direct Known Subclasses

Express::Request

Constant Summary collapse

ENDPOINT =
{
  :production => 'https://api-3t.paypal.com/nvp',
  :sandbox => 'https://api-3t.sandbox.paypal.com/nvp'
}

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Util

#==, formatted_amount, #numeric_attribute?, to_numeric

Constructor Details

#initialize(attributes = {}) ⇒ Request

Returns a new instance of Request.



21
22
23
24
# File 'lib/paypal/nvp/request.rb', line 21

def initialize(attributes = {})
  @version = API_VERSION
  super
end

Instance Attribute Details

#versionObject

Returns the value of attribute version.



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

def version
  @version
end

Class Method Details

.endpointObject



13
14
15
16
17
18
19
# File 'lib/paypal/nvp/request.rb', line 13

def self.endpoint
  if Paypal.sandbox?
    ENDPOINT[:sandbox]
  else
    ENDPOINT[:production]
  end
end

Instance Method Details

#common_paramsObject



26
27
28
29
30
31
32
33
34
# File 'lib/paypal/nvp/request.rb', line 26

def common_params
  {
    :USER => self.username,
    :PWD => self.password,
    :SIGNATURE => self.signature,
    :SUBJECT => self.subject,
    :VERSION => self.version
  }
end

#request(method, params = {}) ⇒ Object



36
37
38
39
40
# File 'lib/paypal/nvp/request.rb', line 36

def request(method, params = {})
  handle_response do
    post(method, params)
  end
end