Class: IntersoftAPI::Resource

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

Direct Known Subclasses

ShipmentResource, ShippingAccountResource

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(client) ⇒ Resource

Returns a new instance of Resource.



7
8
9
# File 'lib/intersoft_api/resource.rb', line 7

def initialize(client)
  @client = client
end

Instance Attribute Details

#clientObject (readonly)

Returns the value of attribute client.



5
6
7
# File 'lib/intersoft_api/resource.rb', line 5

def client
  @client
end

Instance Method Details

#get_request(url, params: {}, headers: {}) ⇒ Object



11
12
13
# File 'lib/intersoft_api/resource.rb', line 11

def get_request(url, params: {}, headers: {})
  handle_response client.connection.get(url, params, headers)
end

#post_request(url, body:, headers: {}) ⇒ Object



15
16
17
# File 'lib/intersoft_api/resource.rb', line 15

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

#put_request(url, body:, headers: {}) ⇒ Object



19
20
21
# File 'lib/intersoft_api/resource.rb', line 19

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