Class: BadBill::Client

Inherits:
BaseResource show all
Defined in:
lib/badbill/client.rb

Overview

The clients resource handles all clients.

See www.billomat.com/en/api/clients/

Instance Attribute Summary collapse

Attributes inherited from BaseResource

#data, #id

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from BaseResource

all, create, #delete, #error, find, #save

Methods included from Resource

#call, #delete, #get, #post, #put

Methods included from ForwardMethods

#method_missing, #respond_to?

Constructor Details

#initialize(id, data) ⇒ Client

Returns a new instance of Client.



10
11
12
13
# File 'lib/badbill/client.rb', line 10

def initialize id, data
  super
  @myself = false
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class BadBill::ForwardMethods

Instance Attribute Details

#myself=(value) ⇒ Object (writeonly)

Sets the attribute myself

Parameters:

  • value

    the value to set the attribute myself to.



8
9
10
# File 'lib/badbill/client.rb', line 8

def myself=(value)
  @myself = value
end

Class Method Details

.myselfClient

Fetch information about yourself.

Returns:

  • (Client)

    A new resource.



18
19
20
21
22
23
# File 'lib/badbill/client.rb', line 18

def self.myself
  c = get 'clients', 'myself'
  client = new c.client.id.to_i, c.client
  client.myself = true
  client
end

Instance Method Details

#myself?Boolean

Indicates wether this resource is yourself or not.

Returns:

  • (Boolean)

    Wether or not this resource is yourself.



28
29
30
# File 'lib/badbill/client.rb', line 28

def myself?
  @myself
end