Class: Harvester::Client

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(subdomain, email, password) ⇒ Client

Returns a new instance of Client.



8
9
10
11
12
13
14
15
# File 'lib/harvester.rb', line 8

def initialize(subdomain, email, password)
  @subdomain = subdomain
  @email = email
  @password = password
  @rest_resource = RestClient::Resource.new(base_url,
                                            email,
                                            password)
end

Instance Attribute Details

#emailObject (readonly)

Returns the value of attribute email.



6
7
8
# File 'lib/harvester.rb', line 6

def email
  @email
end

#passwordObject (readonly)

Returns the value of attribute password.



6
7
8
# File 'lib/harvester.rb', line 6

def password
  @password
end

#rest_resourceObject (readonly)

Returns the value of attribute rest_resource.



6
7
8
# File 'lib/harvester.rb', line 6

def rest_resource
  @rest_resource
end

#subdomainObject (readonly)

Returns the value of attribute subdomain.



6
7
8
# File 'lib/harvester.rb', line 6

def subdomain
  @subdomain
end

Instance Method Details

#base_urlObject



17
18
19
# File 'lib/harvester.rb', line 17

def base_url
  "https://#{ subdomain }.harvestapp.com"
end

#invoicesObject



21
22
23
# File 'lib/harvester.rb', line 21

def invoices
  @invoices ||= Harvester::Invoices.new(self)
end