Module: Radio5::Client::Islands::Parser
- Extended by:
- Utils
- Defined in:
- lib/radio5/client/islands.rb
Constant Summary
Constants included from Radio5::Constants
Radio5::Constants::ASSET_HOST, Radio5::Constants::DECADES, Radio5::Constants::IMAGE_SIZES, Radio5::Constants::MAX_PAGE_SIZE, Radio5::Constants::MOODS, Radio5::Constants::MOODS_MAPPING, Radio5::Constants::USER_TRACK_STATUSES, Radio5::Constants::USER_TRACK_STATUSES_MAPPING
Class Method Summary collapse
Methods included from Utils
create_asset_url, normalize_string, parse_asset_url, parse_image_urls, parse_json, parse_time_string, parse_unix_timestamp, stringify_moods, stringify_user_track_status, symbolize_mood, symbolize_user_track_status
Class Method Details
.island_info(island) ⇒ Object
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 |
# File 'lib/radio5/client/islands.rb', line 17 def self.island_info(island) rank_value = island[:sort] rank = rank_value if rank_value.is_a?(Integer) created_at = parse_time_string(island.fetch(:created).fetch(:date)) created_by = island.fetch(:created).fetch(:user_id) updated_node = island[:modified] updated_at = updated_node && parse_time_string(updated_node.fetch(:date)) updated_by = updated_node&.fetch(:user_id) { id: island.fetch(:_id), uuid: island.fetch(:uuid), api_id: island[:apiid], name: normalize_string(island.fetch(:name)), info: normalize_string(island[:info]), category: normalize_string(island[:category]), favourite_count: island[:favorites], play_count: island.fetch(:plays), rank: rank, icon_url: parse_asset_url(island[:icon]), splash_url: parse_asset_url(island[:splash]), marker_url: parse_asset_url(island[:marker]), enabled: island.fetch(:enabled), free: island[:free], on_map: island.fetch(:onmap), random: island.fetch(:random), play_mode: island[:play], created_at: created_at, created_by: created_by, updated_at: updated_at, updated_by: updated_by } end |