Class: PurolatorRuby::Request
- Inherits:
-
Object
- Object
- PurolatorRuby::Request
- Defined in:
- lib/purolator_ruby/request.rb
Instance Attribute Summary collapse
-
#client ⇒ Object
readonly
Returns the value of attribute client.
-
#method ⇒ Object
readonly
Returns the value of attribute method.
-
#params ⇒ Object
readonly
Returns the value of attribute params.
Instance Method Summary collapse
-
#initialize(options) ⇒ Request
constructor
A new instance of Request.
- #send ⇒ Object
Constructor Details
#initialize(options) ⇒ Request
Returns a new instance of Request.
7 8 9 10 11 |
# File 'lib/purolator_ruby/request.rb', line 7 def initialize() @client = .fetch(:client) @method = .fetch(:method) @params = .fetch(:params) end |
Instance Attribute Details
#client ⇒ Object (readonly)
Returns the value of attribute client.
5 6 7 |
# File 'lib/purolator_ruby/request.rb', line 5 def client @client end |
#method ⇒ Object (readonly)
Returns the value of attribute method.
5 6 7 |
# File 'lib/purolator_ruby/request.rb', line 5 def method @method end |
#params ⇒ Object (readonly)
Returns the value of attribute params.
5 6 7 |
# File 'lib/purolator_ruby/request.rb', line 5 def params @params end |
Instance Method Details
#send ⇒ Object
13 14 15 16 17 18 19 20 21 22 |
# File 'lib/purolator_ruby/request.rb', line 13 def send payload = payload_class.new( params.merge( account_number: client.account_number, billing_number: client.billing_number)).to_h raw_response = @client.purolator_call(method, message: payload).body response_class.new(raw_response) end |