Module: Snafu::Giants
- Included in:
- Client
- Defined in:
- lib/snafu/giants.rb
Instance Method Summary collapse
-
#get_giants ⇒ Object
Accesses the “giants.list” method from the Glitch API and returns an array of the Giant information.
-
#get_giants_favor ⇒ Object
Accesses the “giants.getFavor” method from the Glitch API and returns an array of giants with their respective favor for the authenticated users.
Instance Method Details
#get_giants ⇒ Object
Accesses the “giants.list” method from the Glitch API and returns an array of the Giant information
6 7 8 9 10 11 12 13 |
# File 'lib/snafu/giants.rb', line 6 def get_giants giants = [] response = self.call("giants.list") response["giants"].each do |short_name, long_name| giants << Models::Giant.new(:name => long_name) end giants end |
#get_giants_favor ⇒ Object
Accesses the “giants.getFavor” method from the Glitch API and returns an array of giants with their respective favor for the authenticated users
Requires an OAuth token with read scope
20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/snafu/giants.rb', line 20 def get_giants_favor giants = [] reponse = self.call("giants.getFavor", :authenticate => true) reponse["giants"].each do |giant_short_name, giant_values| giants << Models::Giant.new( :name => giant_values["name"], :cur_favor => giant_values["cur_favor"], :max_favor => giant_values["max_favor"], :cur_daily_favor => giant_values["cur_daily_favor"], :max_daily_favor => giant_values["max_daily_favor"] ) end giants end |