Class: APIHub::Company
- Defined in:
- lib/apihub/company.rb
Direct Known Subclasses
Class Method Summary collapse
- .find(values, options = {}) ⇒ Object (also: [])
Methods inherited from Resource
delete, endpoint, get, options, path, post, put, request, uri, url
Methods inherited from Mash
#custom_reader, #custom_writer, #deep_merge, #deep_update, #delete, #dup, #fetch, #id, #initialize, #initializing_reader, #key?, #method_missing, new, #regular_dup, #replace, #respond_to?, #shallow_merge, #shallow_update, #type, #underbang_reader
Constructor Details
This class inherits a constructor from APIHub::Mash
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class APIHub::Mash
Class Method Details
.find(values, options = {}) ⇒ Object Also known as: []
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/apihub/company.rb', line 6 def self.find(values, = {}) unless values.is_a?(Hash) values = {:id => values} end = .dup params = .delete(:params) || {} if domain = values[:domain] response = get(uri(:domain, domain), params, ) elsif id = values[:id] response = get(id, params, ) else raise ArgumentError, 'Invalid values' end if response.status == 202 self.new(pending: true) else self.new(response) end rescue Nestful::ResourceNotFound end |