Class: Crunchbase::Location

Inherits:
Object
  • Object
show all
Defined in:
lib/crunchbase/location.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(data, meta) ⇒ Location



10
11
12
13
# File 'lib/crunchbase/location.rb', line 10

def initialize(data, meta)
  @mash = data
  self. = meta
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

#metadataObject

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(options = {})
  opts = options.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