Class: PostmanMta::ApiRequest
- Inherits:
-
Object
- Object
- PostmanMta::ApiRequest
- Includes:
- HTTParty
- Defined in:
- lib/postman_mta/api_request.rb
Instance Attribute Summary collapse
-
#callback ⇒ Object
readonly
Returns the value of attribute callback.
-
#options ⇒ Object
readonly
Returns the value of attribute options.
-
#path ⇒ Object
readonly
Returns the value of attribute path.
-
#request_type ⇒ Object
readonly
Returns the value of attribute request_type.
Instance Method Summary collapse
- #full_path ⇒ Object
-
#initialize(request_type, path, options = {}) ⇒ ApiRequest
constructor
A new instance of ApiRequest.
- #perform ⇒ Object
- #uri ⇒ Object
Constructor Details
#initialize(request_type, path, options = {}) ⇒ ApiRequest
10 11 12 13 14 15 16 |
# File 'lib/postman_mta/api_request.rb', line 10 def initialize(request_type, path, = {}) @callback = PostmanMta.before_request_hook @request_type = request_type @path = path @options = end |
Instance Attribute Details
#callback ⇒ Object (readonly)
Returns the value of attribute callback.
8 9 10 |
# File 'lib/postman_mta/api_request.rb', line 8 def callback @callback end |
#options ⇒ Object (readonly)
Returns the value of attribute options.
8 9 10 |
# File 'lib/postman_mta/api_request.rb', line 8 def @options end |
#path ⇒ Object (readonly)
Returns the value of attribute path.
8 9 10 |
# File 'lib/postman_mta/api_request.rb', line 8 def path @path end |
#request_type ⇒ Object (readonly)
Returns the value of attribute request_type.
8 9 10 |
# File 'lib/postman_mta/api_request.rb', line 8 def request_type @request_type end |
Instance Method Details
#full_path ⇒ Object
22 23 24 |
# File 'lib/postman_mta/api_request.rb', line 22 def full_path @full_path ||= PostmanMta.api_endpoint + path end |
#perform ⇒ Object
18 19 20 |
# File 'lib/postman_mta/api_request.rb', line 18 def perform self.class.send(request_type.downcase, path, ) end |
#uri ⇒ Object
26 27 28 |
# File 'lib/postman_mta/api_request.rb', line 26 def uri @uri ||= URI(full_path) end |