Class: BunqRb::TabUsageSingle

Inherits:
Object
  • Object
show all
Defined in:
lib/bunq_rb/objects/tab_usage_single.rb

Overview

TabUsageSingle

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(hsh = {}) ⇒ TabUsageSingle



6
7
8
# File 'lib/bunq_rb/objects/tab_usage_single.rb', line 6

def initialize(hsh = {})
  @uuid = hsh["uuid"]
end

Instance Attribute Details

#uuidObject (readonly)

Returns the value of attribute uuid.



4
5
6
# File 'lib/bunq_rb/objects/tab_usage_single.rb', line 4

def uuid
  @uuid
end

Class Method Details

.create(hash = {}, user_id, monetary_account_id, cash_register_id) ⇒ Object



14
15
16
17
# File 'lib/bunq_rb/objects/tab_usage_single.rb', line 14

def self.create(hash = {}, user_id, , cash_register_id)
  response = Client.send_method(:post, uri(user_id, , cash_register_id), hash)
  new(response[0]["Uuid"])
end

.uri(user_id, monetary_account_id, cash_register_id) ⇒ Object



10
11
12
# File 'lib/bunq_rb/objects/tab_usage_single.rb', line 10

def self.uri(user_id, , cash_register_id)
  "/v1/user/#{user_id}/monetary-account/#{monetary_account_id}/cash-register/#{cash_register_id}/tab-usage-single"
end

Instance Method Details

#update(hsh = {}, user_id, monetary_account_id, cash_register_id) ⇒ Object



19
20
21
22
23
24
# File 'lib/bunq_rb/objects/tab_usage_single.rb', line 19

def update(hsh = {}, user_id, , cash_register_id)
  url = self.class.uri(user_id, , cash_register_id)
  full_path = [url, uuid].join("/")
  response = Client.send_method(:put, full_path, hsh)
  response[0]["Uuid"]
end