Class: Bookafy::Company

Inherits:
BaseService show all
Defined in:
lib/bookafy/company.rb

Constant Summary

Constants inherited from BaseService

BaseService::API_VERSION

Instance Method Summary collapse

Methods inherited from BaseService

#access_token, #bookafy_api_url, #get

Constructor Details

#initializeCompany

Returns a new instance of Company.



4
5
6
# File 'lib/bookafy/company.rb', line 4

def initialize
  super
end

Instance Method Details

#infoObject



12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/bookafy/company.rb', line 12

def info()
  response = get(uri)
  unless response.code == 200
    return nil
  end

  response_json = JSON.parse(response.body)['response']
  company_json = response_json['company']
  company = Bookafy::Model::Company.new(company_json)

  company
rescue => e
  puts "Error at fetching customers: #{e.message}"
  return nil
end

#uriObject



8
9
10
# File 'lib/bookafy/company.rb', line 8

def uri
  'company'
end