Module: Destiny::Advisors
- Included in:
- Client
- Defined in:
- lib/destiny_rb/advisors.rb
Instance Method Summary collapse
-
#activity_search(activity_hash, raw = false) ⇒ Object
GET the activity information from ‘/manifest/activity/activity_hash/’.
-
#arena(level = 32) ⇒ Object
GET the weekly prison of elders pulled info from ‘/advisors’ endpoint Without any arguments, only returns the level 32 information.
-
#daily_report ⇒ Object
GET the days advisor report from www.bungie.net/platform/destiny/advisors/.
-
#nightfall(raw = false) ⇒ Object
GET the weekly nightfall info from ‘/manifest/activity/#activity_hash’.
-
#weekly_strike(raw = false) ⇒ Object
GET the weekly strike info from ‘/manifest/activity/#activity_hash’ Returns an array of three items, only need one for the skulls and location.
Instance Method Details
#activity_search(activity_hash, raw = false) ⇒ Object
GET the activity information from ‘/manifest/activity/activity_hash/’
Raw argument will return an unmodified respons from Bungie.
Usage:
client.activity('3508129769', false)
Arguments:
activity_hash: (String)
raw: (Boolean)
Returns:
A JSON object containing activity information based on the activity hash supplied with:
activityName: (String)
activityDescription: (String)
skulls: (Array)(Hash)(Strings)
If raw = true, returns whole response back from bungie.
36 37 38 39 40 41 42 43 44 45 46 47 |
# File 'lib/destiny_rb/advisors.rb', line 36 def activity_search(activity_hash, raw=false) raw_data = self.class.get("/Manifest/Activity/#{activity_hash}", headers: @headers).parsed_response['Response']['data']['activity'] skulls = [] raw_data['skulls'].each do |skull| skulls << { :name => skull['displayName'], :description => skull['description'], :icon => skull['icon'] } end if raw raw_data else parsed_data = { activityName: raw_data['activityName'], activityDescription: raw_data['activityDescription'], skulls: skulls, pgcrImage: raw_data['pgcrImage'] } end end |
#arena(level = 32) ⇒ Object
GET the weekly prison of elders pulled info from ‘/advisors’ endpoint Without any arguments, only returns the level 32 information.
Usage:
client.arena(34)
Arguments:
level: (integer)
104 105 106 107 108 109 110 111 112 113 114 |
# File 'lib/destiny_rb/advisors.rb', line 104 def arena(level=32) arenas = self.daily_report['arena'] case level when 32 arenas[0] when 34 arenas[1] when 35 arenas[2] end end |
#daily_report ⇒ Object
GET the days advisor report from www.bungie.net/platform/destiny/advisors/
Usage:
Destiny::Advisors.report
Returns:
A JSON object containing activity hashes, end times, and special events.
12 13 14 15 |
# File 'lib/destiny_rb/advisors.rb', line 12 def daily_report raw_data = self.class.get('/Advisors', headers: @headers) parsed = raw_data.parsed_response['Response']['data'] end |
#nightfall(raw = false) ⇒ Object
GET the weekly nightfall info from ‘/manifest/activity/#activity_hash’
Optional boolean argument.
Usage:
client.nightfall(true)
Arguments:
raw: (boolean)
59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 |
# File 'lib/destiny_rb/advisors.rb', line 59 def nightfall(raw=false) nightfall_info = self.daily_report["nightfall"] nightfall_activity_hash = nightfall_info["activityBundleHash"] activity_info = activity_search(nightfall_activity_hash, raw) if raw activity_info else active_skulls = nightfall_info["tiers"][0]["skullIndexes"] all_skulls = activity_info[:skulls] activity_info[:activeSkulls] = active_skulls.map { |index| all_skulls[index] } specific_activity = activity_search(nightfall_info["tiers"][0]["specificActivityHash"]) activity_info[:specificActivity] = specific_activity activity_info end end |
#weekly_strike(raw = false) ⇒ Object
GET the weekly strike info from ‘/manifest/activity/#activity_hash’ Returns an array of three items, only need one for the skulls and location.
Optional boolean argument, defaults to false from activity method to return basic information for Lita bot.
Usage:
client.weekly_strike(false)
Arguments:
raw: (boolean)
90 91 92 93 |
# File 'lib/destiny_rb/advisors.rb', line 90 def weekly_strike(raw=false) heroic_strike_hashes = self.daily_report['heroicStrikeHashes'] activity_search(heroic_strike_hashes[0], raw) end |