Class: ActivityMapper::ActivityDataMapper
- Inherits:
-
Object
- Object
- ActivityMapper::ActivityDataMapper
- Defined in:
- lib/activity_mapper/activity_data_mapper.rb
Defined Under Namespace
Classes: CouldNotMapError
Instance Attribute Summary collapse
-
#data ⇒ Object
readonly
Returns the value of attribute data.
-
#entries ⇒ Object
readonly
Returns the value of attribute entries.
Instance Method Summary collapse
- #fetch!(url, options = {}) ⇒ Object
-
#initialize(map) ⇒ ActivityDataMapper
constructor
A new instance of ActivityDataMapper.
- #map! ⇒ Object
Constructor Details
#initialize(map) ⇒ ActivityDataMapper
Returns a new instance of ActivityDataMapper.
8 9 10 |
# File 'lib/activity_mapper/activity_data_mapper.rb', line 8 def initialize(map) @map = map end |
Instance Attribute Details
#data ⇒ Object (readonly)
Returns the value of attribute data.
6 7 8 |
# File 'lib/activity_mapper/activity_data_mapper.rb', line 6 def data @data end |
#entries ⇒ Object (readonly)
Returns the value of attribute entries.
6 7 8 |
# File 'lib/activity_mapper/activity_data_mapper.rb', line 6 def entries @entries end |
Instance Method Details
#fetch!(url, options = {}) ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/activity_mapper/activity_data_mapper.rb', line 12 def fetch!(url, = {}) response_body = fetch_url(url, ) # Some sites only provide a JSONP response if [:strip_callback] response_body = strip_callback(response_body) end @data = Connector.deserialize(response_body, [:format]) end |
#map! ⇒ Object
24 25 26 |
# File 'lib/activity_mapper/activity_data_mapper.rb', line 24 def map! @entries = map(@data) end |