Class: MyTankInfo::Resource

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(client) ⇒ Resource

Returns a new instance of Resource.



7
8
9
# File 'lib/my_tank_info/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/my_tank_info/resource.rb', line 5

def client
  @client
end

Instance Method Details

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



27
28
29
# File 'lib/my_tank_info/resource.rb', line 27

def delete_request(url, params: {}, headers: {})
  handle_response client.connection.delete(url, params, default_headers.merge(headers))
end

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



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

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

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



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

def patch_request(url, body:, headers: {})
  handle_response client.connection.patch(url, body, default_headers.merge(headers))
end

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



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

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

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



23
24
25
# File 'lib/my_tank_info/resource.rb', line 23

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