Class: Crunchbase::Location
- Inherits:
-
Object
- Object
- Crunchbase::Location
- Defined in:
- lib/crunchbase/location.rb
Instance Attribute Summary collapse
-
#metadata ⇒ Object
Returns the value of attribute metadata.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(data, meta) ⇒ Location
constructor
A new instance of Location.
- #method_missing(method_sym, *arguments, &block) ⇒ Object
Constructor Details
#initialize(data, meta) ⇒ Location
10 11 12 13 |
# File 'lib/crunchbase/location.rb', line 10 def initialize(data, ) @mash = data self. = end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method_sym, *arguments, &block) ⇒ Object
15 16 17 |
# File 'lib/crunchbase/location.rb', line 15 def method_missing(method_sym, *arguments, &block) @mash.send(method_sym, *arguments) end |
Instance Attribute Details
#metadata ⇒ Object
Returns the value of attribute metadata.
8 9 10 |
# File 'lib/crunchbase/location.rb', line 8 def end |
Class Method Details
.all(options = {}) ⇒ Object
19 20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/crunchbase/location.rb', line 19 def self.all( = {}) opts = .merge({user_key: Crunchbase.config.user_key}) response = Faraday.get("#{Crunchbase.config.host}/#{Crunchbase.config.api_version_prefix}/locations", opts) raise "Error" if response.status != 200 # ignore paging raw = Hashie::Mash.new(JSON.parse(response.body)) collection = raw.data.items collection.map { |item| new(item, raw.) } rescue [] end |