Class: Bookafy::Company
- Inherits:
-
BaseService
- Object
- BaseService
- Bookafy::Company
- Defined in:
- lib/bookafy/company.rb
Constant Summary
Constants inherited from BaseService
Instance Method Summary collapse
- #info ⇒ Object
-
#initialize ⇒ Company
constructor
A new instance of Company.
- #uri ⇒ Object
Methods inherited from BaseService
#access_token, #bookafy_api_url, #get
Constructor Details
#initialize ⇒ Company
Returns a new instance of Company.
4 5 6 |
# File 'lib/bookafy/company.rb', line 4 def initialize super end |
Instance Method Details
#info ⇒ Object
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.}" return nil end |
#uri ⇒ Object
8 9 10 |
# File 'lib/bookafy/company.rb', line 8 def uri 'company' end |