Class: Unleashed::CompanyResource
- Inherits:
-
BaseResource
- Object
- BaseResource
- Unleashed::CompanyResource
- Defined in:
- lib/unleashed/resources/company_resource.rb
Overview
The Companies resource allows Companies to be listed. An individual Company details can be viewed by appending its identifier (a GUID formatted as XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX) to the URI. Here are some example URIs: /Companies - returns a list of Company related information.
Instance Method Summary collapse
-
#all ⇒ Array<Unleashed::Company>
Lists all information for your company /Companies - returns a list of Company related information.
-
#first ⇒ Unleashed::Company
Get a first company in all.
-
#last ⇒ Unleashed::Company
Get a last company in all.
- #model ⇒ Object
Methods inherited from BaseResource
#initialize, #method_missing, #respond_to?
Constructor Details
This class inherits a constructor from Unleashed::BaseResource
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class Unleashed::BaseResource
Instance Method Details
#all ⇒ Array<Unleashed::Company>
Lists all information for your company /Companies - returns a list of Company related information.
17 18 19 20 21 22 |
# File 'lib/unleashed/resources/company_resource.rb', line 17 def all endpoint = 'Companies' response = JSON.parse(@client.get(endpoint).body) companies = response.key?('Items') ? response['Items'] : [] companies.map { |attributes| Unleashed::Company.new(@client, attributes) } end |
#first ⇒ Unleashed::Company
Get a first company in all
27 28 29 |
# File 'lib/unleashed/resources/company_resource.rb', line 27 def first all.first end |
#last ⇒ Unleashed::Company
Get a last company in all
34 35 36 |
# File 'lib/unleashed/resources/company_resource.rb', line 34 def last all.last end |