Class: ShippyProAPI::Resource
- Inherits:
-
Object
- Object
- ShippyProAPI::Resource
- Defined in:
- lib/shippy_pro_api/resource.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#client ⇒ Object
readonly
Returns the value of attribute client.
Instance Method Summary collapse
-
#initialize(client) ⇒ Resource
constructor
A new instance of Resource.
-
#post_request(url, body:, headers: {}) ⇒ Object
def get_request(url, params: {}, headers: {}) handle_response client.connection.get(url, params, headers) end.
Constructor Details
#initialize(client) ⇒ Resource
Returns a new instance of Resource.
9 10 11 |
# File 'lib/shippy_pro_api/resource.rb', line 9 def initialize(client) @client = client end |
Instance Attribute Details
#client ⇒ Object (readonly)
Returns the value of attribute client.
7 8 9 |
# File 'lib/shippy_pro_api/resource.rb', line 7 def client @client end |
Instance Method Details
#post_request(url, body:, headers: {}) ⇒ Object
def get_request(url, params: {}, headers: {})
handle_response client.connection.get(url, params, headers)
end
17 18 19 |
# File 'lib/shippy_pro_api/resource.rb', line 17 def post_request(url, body:, headers: {}) handle_response client.connection.post(url, parse_body(body), headers) end |