Class: Inventory

Inherits:
Object
  • Object
show all
Defined in:
lib/minitest/game/inventory.rb

Class Method Summary collapse

Class Method Details

.add(item, credentials) ⇒ Object



12
13
14
15
16
17
18
# File 'lib/minitest/game/inventory.rb', line 12

def add(item, credentials)
  url = NagaApiClient.BASE_URL + "inventory/add"
  options = { headers: { "Content-Type" => "application/x-www-form-urlencoded" } }
  options[:body] = "email=" + credentials[:email] + "&authentication_token=" + credentials[:authentication_token] + "&item_id=" + item.id.to_s
  response = HTTParty.post(url, options)
  handle_add(response.parsed_response, item, "backpack")
end

.add_to_desk(item, credentials) ⇒ Object



4
5
6
7
8
9
10
# File 'lib/minitest/game/inventory.rb', line 4

def add_to_desk(item, credentials)
  url = NagaApiClient.BASE_URL + "inventory/desk/add"
  options = { headers: { "Content-Type" => "application/x-www-form-urlencoded" } }
  options[:body] = "email=" + credentials[:email] + "&authentication_token=" + credentials[:authentication_token] + "&item_id=" + item.id.to_s
  response = HTTParty.post(url, options)
  handle_add(response.parsed_response, item, "desk")
end