Class: WalkscoreApi::Walkscore

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

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes) ⇒ Walkscore

Returns a new instance of Walkscore.



7
8
9
10
11
12
13
# File 'lib/walkscore/walkscore.rb', line 7

def initialize(attributes)
  self.score       = attributes['walkscore']
  self.description = attributes['description']
  self.updated     = attributes['updated']
  self.logo_url    = attributes['logo_url']
  self.ws_link     = attributes['ws_link']
end

Instance Attribute Details

#descriptionObject

Returns the value of attribute description.



5
6
7
# File 'lib/walkscore/walkscore.rb', line 5

def description
  @description
end

#logo_urlObject

Returns the value of attribute logo_url.



5
6
7
# File 'lib/walkscore/walkscore.rb', line 5

def logo_url
  @logo_url
end

#scoreObject

Returns the value of attribute score.



5
6
7
# File 'lib/walkscore/walkscore.rb', line 5

def score
  @score
end

#updatedObject

Returns the value of attribute updated.



5
6
7
# File 'lib/walkscore/walkscore.rb', line 5

def updated
  @updated
end

Returns the value of attribute ws_link.



5
6
7
# File 'lib/walkscore/walkscore.rb', line 5

def ws_link
  @ws_link
end

Class Method Details

.clientObject



15
16
17
# File 'lib/walkscore/walkscore.rb', line 15

def self.client
  WalkscoreApi::Client.new
end

.find(location, api_key) ⇒ Object



19
20
21
22
# File 'lib/walkscore/walkscore.rb', line 19

def self.find(location, api_key)
  parsed_results = JSON.parse(client.make_connection(location, api_key))
  WalkscoreApi::Walkscore.new(parsed_results)
end