Class: ShippyProAPI::Resource

Inherits:
Object
  • Object
show all
Defined in:
lib/shippy_pro_api/resource.rb

Direct Known Subclasses

ShipmentResource

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#clientObject (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



13
14
15
# File 'lib/shippy_pro_api/resource.rb', line 13

def post_request(url, body:, headers: {})
  handle_response client.connection.post(url, parse_body(body), headers)
end