steam-trade 0.0.9 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/Badge.rb +20 -8
- data/lib/IEconService.rb +91 -0
- data/lib/Inventory.rb +165 -19
- data/lib/LoginExecutor.rb +1 -1
- data/lib/Misc.rb +16 -3
- data/lib/Trade.rb +24 -1
- data/lib/meta/version.rb +1 -1
- data/lib/steam-trade.rb +23 -10
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 821dfc0b7359db3a2119a930ca53b13a543634d4
|
4
|
+
data.tar.gz: 20e4fcdf9864d781083a9fa6360927bc1593e341
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 07ce8d290f7ebc8ebd3cae55984b896c8f2b6970c9c577e3428a732bd35b17250e2df40fd18a8709610858205066cd7c475a28a6c4efb26824bcf51fe684b97b
|
7
|
+
data.tar.gz: f671b05935a3c504ee86ad53f4cf5c4bc95fc4fce5eb326d6a2d8a361abce98bba7fbf172ad1b899a206c8bbcc9517a344c7646933b77b9c8a04d91766385344
|
data/lib/Badge.rb
CHANGED
@@ -27,22 +27,34 @@ module BadgeCommands
|
|
27
27
|
targetname = ''
|
28
28
|
end
|
29
29
|
}
|
30
|
-
|
31
|
-
items = normal_get_inventory(steamid)
|
30
|
+
hash = raw_get_inventory(steamid)
|
32
31
|
sorted = {}
|
33
|
-
|
32
|
+
classxinstance = {}
|
33
|
+
|
34
|
+
hash["descriptions"].delete_if {|desc|
|
35
|
+
conc = desc["classid"] + "_" + desc["instanceid"]
|
36
|
+
classxinstance[conc] = desc
|
37
|
+
true
|
38
|
+
}
|
39
|
+
|
40
|
+
#GC.start
|
41
|
+
|
42
|
+
|
43
|
+
hash["assets"].each { |asset|
|
44
|
+
identity = asset["classid"] + "_" + asset["instanceid"]
|
45
|
+
assetdesc = classxinstance[identity]
|
34
46
|
if use_nonmarketable == false
|
35
|
-
if
|
47
|
+
if assetdesc["marketable"] == 0 || assetdesc["tags"][-1]["localized_tag_name"] != "Trading Card" || assetdesc["tags"][-2]["localized_tag_name"] == "Foil"
|
36
48
|
next
|
37
49
|
end
|
38
50
|
else
|
39
|
-
if
|
51
|
+
if assetdesc["tags"][-1]["localized_tag_name"] != "Trading Card" ||assetdesc["tags"][-2]["localized_tag_name"] == "Foil"
|
40
52
|
next
|
41
53
|
end
|
42
54
|
end
|
43
55
|
|
44
|
-
name =
|
45
|
-
appid =
|
56
|
+
name = assetdesc["name"].sub(" (Trading Card)", "")
|
57
|
+
appid =assetdesc["market_fee_app"].to_s
|
46
58
|
if sorted.has_key?(appid) == true
|
47
59
|
if sorted[appid].has_key?(name) == true
|
48
60
|
sorted[appid][name] = sorted[appid][name] + 1
|
@@ -106,7 +118,7 @@ module BadgeCommands
|
|
106
118
|
File.truncate("./#{filename}_badges.txt", 0)
|
107
119
|
rescue
|
108
120
|
end
|
109
|
-
|
121
|
+
output "Writing the badges to #{filename}_badges.txt "
|
110
122
|
File.open("./#{filename}_badges.txt",'a+:UTF-8') {|f| f.puts "for #{persona}(#{steamid})"}
|
111
123
|
if use_nonmarketable == false
|
112
124
|
File.open("./#{filename}_badges.txt",'a+:UTF-8') {|f| f.puts "total non-foil trading cards #{total_non_foil}"}
|
data/lib/IEconService.rb
ADDED
@@ -0,0 +1,91 @@
|
|
1
|
+
module OfferState
|
2
|
+
Invalid = 1
|
3
|
+
Active = 2
|
4
|
+
Accepted = 3
|
5
|
+
Countered = 4
|
6
|
+
Expired = 5
|
7
|
+
Canceled = 6
|
8
|
+
Declined = 7
|
9
|
+
InvalidItems = 8
|
10
|
+
ConfirmationNeed = 9
|
11
|
+
CanceledBySecondaryFactor = 10
|
12
|
+
StateInEscrow = 11
|
13
|
+
end
|
14
|
+
|
15
|
+
module OfferConfirm
|
16
|
+
Invalid = 1
|
17
|
+
Email = 2
|
18
|
+
MobileApp = 3
|
19
|
+
end
|
20
|
+
|
21
|
+
module TradeAPI
|
22
|
+
def get_trade_offers(time = "")
|
23
|
+
raise "have no API_key, cannot get trade offers" if @api_key == nil
|
24
|
+
params = {'key'=> @api_key,
|
25
|
+
'get_sent_offers'=> 1,
|
26
|
+
'get_received_offers'=> 1,
|
27
|
+
'get_descriptions'=> 1,
|
28
|
+
'language'=> 'english',
|
29
|
+
'active_only'=> 1,
|
30
|
+
'historical_only'=> 0,
|
31
|
+
'time_historical_cutoff'=> time.to_i}
|
32
|
+
data = JSON.parse(api_call('GET', 'IEconService', 'GetTradeOffers', 'v1', params))["response"]
|
33
|
+
return data
|
34
|
+
end
|
35
|
+
|
36
|
+
def accept_trade_offer(trade_offer_id)
|
37
|
+
raise "You are not logged in " if @loggedin == false
|
38
|
+
trade = get_trade_offer(trade_offer_id)
|
39
|
+
trade_offer_state = trade["offer"]['trade_offer_state']
|
40
|
+
raise "Cannot accept trade #{trade_offer_id}" if trade_offer_state != OfferState::Active
|
41
|
+
|
42
|
+
|
43
|
+
partner = trade["offer"]['accountid_other']
|
44
|
+
session_id = sessionid_cookie()
|
45
|
+
accept_url = "https://steamcommunity.com" + '/tradeoffer/' + trade_offer_id + '/accept'
|
46
|
+
params = {'sessionid'=> session_id,
|
47
|
+
'tradeofferid'=> trade_offer_id,
|
48
|
+
'serverid'=> '1',
|
49
|
+
'partner'=> partner,
|
50
|
+
'captcha'=> ''}
|
51
|
+
headers = {'Referer'=> "https://steamcommunity.com/tradeoffer/#{trade_offer_id}"}
|
52
|
+
response = JSON.parse(@session.post(accept_url, params, headers).content)
|
53
|
+
output "trade offer confirmed"
|
54
|
+
if response.key?('needs_mobile_confirmation') == true
|
55
|
+
re = send_trade_allow_request(trade_offer_id)
|
56
|
+
output "trade offer confirmed"
|
57
|
+
return re
|
58
|
+
end
|
59
|
+
return response
|
60
|
+
end
|
61
|
+
|
62
|
+
def get_trade_offer(trade_offer_id)
|
63
|
+
raise "have no API_key, cannot get the trade offer" if @api_key == nil
|
64
|
+
params = {'key' => @api_key,
|
65
|
+
'tradeofferid'=>trade_offer_id,
|
66
|
+
'language'=> 'english'}
|
67
|
+
response = JSON.parse(api_call('GET', 'IEconService', 'GetTradeOffer', 'v1', params))
|
68
|
+
return response["response"]
|
69
|
+
end
|
70
|
+
|
71
|
+
def decline_trade_offer(trade_offer_id)
|
72
|
+
raise "have no API_key, cannot decline the trade offer" if @api_key == nil
|
73
|
+
params = {'key'=> @api_key,
|
74
|
+
'tradeofferid'=> trade_offer_id}
|
75
|
+
return JSON.parse(api_call('POST', 'IEconService', 'DeclineTradeOffer', 'v1', params))
|
76
|
+
end
|
77
|
+
|
78
|
+
def cancel_trade_offer(trade_offer_id)
|
79
|
+
raise "have no API_key, cannot cancel the trade offer" if @api_key == nil
|
80
|
+
params = {'key'=> @api_key,
|
81
|
+
'tradeofferid'=> trade_offer_id}
|
82
|
+
return JSON.parse(api_call('POST', 'IEconService', 'CancelTradeOffer', 'v1', params))
|
83
|
+
|
84
|
+
end
|
85
|
+
|
86
|
+
|
87
|
+
|
88
|
+
|
89
|
+
|
90
|
+
|
91
|
+
end
|
data/lib/Inventory.rb
CHANGED
@@ -8,11 +8,8 @@ module InventoryCommands
|
|
8
8
|
if steamid == nil
|
9
9
|
raise "not logged-in and no steamid specified"
|
10
10
|
end
|
11
|
-
|
12
|
-
|
13
11
|
appid = appid.to_s
|
14
12
|
context = 6
|
15
|
-
|
16
13
|
#verify given appid only
|
17
14
|
if (3..6).to_a.include?(steamid.to_i.to_s.length)
|
18
15
|
raise "You cannot give an appid only if you are not logged in" if @steamid == nil
|
@@ -20,7 +17,6 @@ module InventoryCommands
|
|
20
17
|
steamid = @steamid
|
21
18
|
end
|
22
19
|
# end given appid only
|
23
|
-
|
24
20
|
#verify given another game
|
25
21
|
if appid.to_s != "753"
|
26
22
|
context = 2
|
@@ -28,10 +24,7 @@ module InventoryCommands
|
|
28
24
|
#end verify given another game
|
29
25
|
# end verify given appid only
|
30
26
|
#verify trade link
|
31
|
-
|
32
|
-
|
33
27
|
steamid,token = verify_profileid_or_trade_link_or_steamid(steamid)
|
34
|
-
|
35
28
|
raise "invalid steamid : #{steamid}, length of received :: #{steamid.to_s.length}, normal is 17" if steamid.to_s.length != 17
|
36
29
|
## verify appid
|
37
30
|
if ["753","730",'570','440'].include?(appid.to_s) == false
|
@@ -39,15 +32,12 @@ module InventoryCommands
|
|
39
32
|
raise "invalid appid: #{appid}" if allgames.include?(appid.to_s) == false
|
40
33
|
end
|
41
34
|
## end verify appid
|
42
|
-
|
43
35
|
if @inventory_cache == true
|
44
|
-
verdict = verify_inventory_cache(steamid,appid)
|
36
|
+
verdict = verify_inventory_cache('normal',steamid,appid)
|
45
37
|
if verdict != false
|
46
38
|
return verdict
|
47
39
|
end
|
48
40
|
end
|
49
|
-
|
50
|
-
|
51
41
|
items = []
|
52
42
|
last_id = 0
|
53
43
|
until last_id == false
|
@@ -60,11 +50,129 @@ module InventoryCommands
|
|
60
50
|
|
61
51
|
output "total loaded #{items.length} asset"
|
62
52
|
if @inventory_cache == true
|
63
|
-
File.open("
|
53
|
+
File.open("./normal_#{steamid}_#{appid}.inventory", 'w') {|f| f.puts items.to_json}
|
64
54
|
end
|
65
55
|
|
66
56
|
return items
|
67
57
|
end
|
58
|
+
###################################
|
59
|
+
|
60
|
+
|
61
|
+
|
62
|
+
|
63
|
+
###################################
|
64
|
+
def raw_get_inventory(*params)#steamid = @steamid ,appid = 753, trim = true
|
65
|
+
raise "expected 3 paramters, given #{params.length}"if params.length > 3
|
66
|
+
steamid = @steamid
|
67
|
+
appid = 753
|
68
|
+
trim = true
|
69
|
+
context = 6
|
70
|
+
|
71
|
+
if params.length == 3
|
72
|
+
params.delete_if { |para|
|
73
|
+
if [TrueClass,FalseClass].include?(para.class)
|
74
|
+
trim = para
|
75
|
+
true
|
76
|
+
else
|
77
|
+
false
|
78
|
+
end
|
79
|
+
}
|
80
|
+
raise "could not determine trimming boolean" if params.length != 2
|
81
|
+
|
82
|
+
params.delete_if { |para|
|
83
|
+
if (3..6).to_a.include?(para.to_i.to_s.length)
|
84
|
+
appid = para
|
85
|
+
true
|
86
|
+
else
|
87
|
+
false
|
88
|
+
end
|
89
|
+
}
|
90
|
+
raise "could not distinguish between appID and steamID" if params.length != 1
|
91
|
+
|
92
|
+
steamid = params[0]
|
93
|
+
|
94
|
+
elsif params.length == 2 && params.count {|x| x == true || x == false} >= 1
|
95
|
+
params.delete_if {|para|
|
96
|
+
if [TrueClass,FalseClass].include?(para.class)
|
97
|
+
trim = para
|
98
|
+
true
|
99
|
+
else
|
100
|
+
false
|
101
|
+
end
|
102
|
+
}
|
103
|
+
raise "given 2 booleans ? param1 : #{params[0]}, param2 #{params[1]}" if params.length != 1
|
104
|
+
if (3..6).to_a.include?(params[0].to_i.to_s.length)
|
105
|
+
appid = params[0]
|
106
|
+
else
|
107
|
+
steamid = params[0]
|
108
|
+
end
|
109
|
+
elsif params.length == 2 && params.count {|x| x == true || x == false} == 0
|
110
|
+
params.delete_if { |para|
|
111
|
+
if (3..6).to_a.include?(para.to_i.to_s.length)
|
112
|
+
appid = para
|
113
|
+
true
|
114
|
+
else
|
115
|
+
false
|
116
|
+
end
|
117
|
+
}
|
118
|
+
raise "unable to distinguish profileID from appID:: #{params[0]} and #{params[1]}" if params.length != 1
|
119
|
+
steamid = params[0]
|
120
|
+
elsif params.length == 1
|
121
|
+
if params.count {|x| x == true || x == false} == 1
|
122
|
+
trim = params[0]
|
123
|
+
elsif (3..6).to_a.include?(params[0].to_i.to_s.length)
|
124
|
+
appid = params[0]
|
125
|
+
else
|
126
|
+
steamid = params[0]
|
127
|
+
end
|
128
|
+
end
|
129
|
+
|
130
|
+
steamid,token = verify_profileid_or_trade_link_or_steamid(steamid)
|
131
|
+
raise "invalid steamid : #{steamid}, length of received :: #{steamid.to_s.length}, normal is 17" if steamid.to_s.length != 17
|
132
|
+
## verify appid
|
133
|
+
if ["753","730",'570','440'].include?(appid.to_s) == false
|
134
|
+
allgames = JSON.parse(File.read("#{@libdir}blueprints/game_inv_list.json"))
|
135
|
+
raise "invalid appid: #{appid}" if allgames.include?(appid.to_s) == false
|
136
|
+
end
|
137
|
+
## end verify appid
|
138
|
+
|
139
|
+
if appid.to_s != "753"
|
140
|
+
context = 2
|
141
|
+
end
|
142
|
+
|
143
|
+
if @inventory_cache == true
|
144
|
+
verdict = verify_inventory_cache('raw',steamid,appid)
|
145
|
+
if verdict != false
|
146
|
+
return verdict
|
147
|
+
end
|
148
|
+
end
|
149
|
+
last_id = 0
|
150
|
+
hash = {"assets" => [], "descriptions" => []}
|
151
|
+
until last_id == false
|
152
|
+
received = get_inventory_chunk_raw_way(appid,context,steamid,last_id,trim)
|
153
|
+
last_id = received['new_last_id']
|
154
|
+
hash["assets"] = hash["assets"] + received['assets']
|
155
|
+
hash["descriptions"] = hash["descriptions"] + received["descriptions"]
|
156
|
+
output "loaded #{hash["assets"].length}"
|
157
|
+
sleep(2) if last_id != false
|
158
|
+
end
|
159
|
+
|
160
|
+
output "total loaded #{hash["assets"].length} asset"
|
161
|
+
if @inventory_cache == true
|
162
|
+
File.open("./raw_#{steamid}_#{appid}.inventory", 'w') {|f| f.puts hash.to_json}
|
163
|
+
end
|
164
|
+
|
165
|
+
return hash
|
166
|
+
end
|
167
|
+
|
168
|
+
|
169
|
+
|
170
|
+
|
171
|
+
|
172
|
+
|
173
|
+
|
174
|
+
|
175
|
+
|
68
176
|
|
69
177
|
private
|
70
178
|
def get_inventory_chunk_normal_way(appid,context,steamid,last_id)
|
@@ -105,29 +213,67 @@ module InventoryCommands
|
|
105
213
|
|
106
214
|
return {'assets' => assets, 'new_last_id' =>new_last_id}
|
107
215
|
|
108
|
-
end
|
216
|
+
end ## end inventory get normal
|
217
|
+
|
218
|
+
#######################################
|
219
|
+
|
220
|
+
|
221
|
+
#####################################
|
222
|
+
|
223
|
+
|
224
|
+
def get_inventory_chunk_raw_way(appid,context,steamid,last_id,trim)
|
225
|
+
|
226
|
+
|
227
|
+
html = open("https://steamcommunity.com/inventory/#{steamid}/#{appid}/#{context}?start_assetid=#{last_id}&count=5000").read
|
228
|
+
|
229
|
+
get = JSON.parse(html)
|
230
|
+
raise "something totally unexpected happened while getting inventory with appid #{appid} of steamid #{steamid} with contextid #{context}" if get.key?("error") == true
|
231
|
+
if get["total_inventory_count"] == 0
|
232
|
+
output "EMPTY :: inventory with appid #{appid} of steamid #{steamid} with contextid #{context}"
|
233
|
+
return {'assets' => [], "descriptions" => [], 'new_last_id' =>false}
|
234
|
+
end
|
235
|
+
if get.keys[3].to_s == "last_assetid"
|
236
|
+
|
237
|
+
new_last_id = get.values[3].to_s
|
238
|
+
|
239
|
+
else
|
240
|
+
new_last_id = false
|
241
|
+
|
242
|
+
end
|
243
|
+
|
244
|
+
assets = get["assets"]
|
245
|
+
descriptions = get["descriptions"]
|
246
|
+
if trim == true
|
247
|
+
descriptions.each { |desc|
|
248
|
+
desc.delete_if {|key, value| key != "appid" && key != "classid" && key != "instanceid" && key != "tags" && key != "type" && key != "market_fee_app" && key != "marketable" &&key != "name" }
|
249
|
+
desc["tags"].delete_at(0)
|
250
|
+
desc["tags"].delete_at(0)
|
251
|
+
}
|
252
|
+
end
|
109
253
|
|
254
|
+
return {'assets' => get["assets"], "descriptions" => get["descriptions"], 'new_last_id' =>new_last_id}
|
110
255
|
|
256
|
+
end
|
111
257
|
|
112
258
|
|
113
259
|
|
114
|
-
def verify_inventory_cache(steamid,appid)
|
115
|
-
if File.exists?("./#{steamid}_#{appid}.inventory") == false
|
260
|
+
def verify_inventory_cache(type,steamid,appid)
|
261
|
+
if File.exists?("./#{type}_#{steamid}_#{appid}.inventory") == false
|
116
262
|
return false
|
117
263
|
end
|
118
264
|
|
119
|
-
file_last_time = Time.parse(File.mtime("./#{steamid}_#{appid}.inventory").to_s)
|
265
|
+
file_last_time = Time.parse(File.mtime("./#{type}_#{steamid}_#{appid}.inventory").to_s)
|
120
266
|
current_time = Time.parse(Time.now.to_s)
|
121
267
|
calcule = current_time - file_last_time
|
122
268
|
if calcule.to_i > @inventory_validity
|
123
|
-
File.delete("./#{steamid}_#{appid}.inventory")
|
269
|
+
File.delete("./#{type}_#{steamid}_#{appid}.inventory")
|
124
270
|
return false
|
125
271
|
else
|
126
272
|
output "gonna use cached inventory which is #{calcule} seconds old"
|
127
273
|
begin
|
128
|
-
return JSON.parse(File.read("./#{steamid}_#{appid}.inventory",:external_encoding => 'utf-8',:internal_encoding => 'utf-8'))
|
274
|
+
return JSON.parse(File.read("./#{type}_#{steamid}_#{appid}.inventory",:external_encoding => 'utf-8',:internal_encoding => 'utf-8'))
|
129
275
|
rescue
|
130
|
-
File.delete("./#{steamid}_#{appid}.inventory")
|
276
|
+
File.delete("./#{type}_#{steamid}_#{appid}.inventory")
|
131
277
|
return false
|
132
278
|
end
|
133
279
|
end
|
data/lib/LoginExecutor.rb
CHANGED
@@ -36,7 +36,7 @@ module LoginCommands
|
|
36
36
|
elsif repeater == 3
|
37
37
|
raise "Login failed username: #{@username}, password: #{@password}, shared_scret: #{@secret} tried 3 times"
|
38
38
|
else
|
39
|
-
print
|
39
|
+
print response
|
40
40
|
puts "re-trying to login"
|
41
41
|
puts "sleeping for 6 seconds"
|
42
42
|
sleep(6)
|
data/lib/Misc.rb
CHANGED
@@ -33,7 +33,6 @@ module MiscCommands
|
|
33
33
|
|
34
34
|
|
35
35
|
|
36
|
-
private
|
37
36
|
def partner_id_to_steam_id(account_id)
|
38
37
|
unknown_constant = 17825793 # or 0x1100001 idk wtf is this but ....
|
39
38
|
first_bytes = [account_id.to_i].pack('i>')
|
@@ -41,10 +40,11 @@ module MiscCommands
|
|
41
40
|
collect = last_bytes + first_bytes
|
42
41
|
return collect.unpack('Q>')[0].to_s
|
43
42
|
end
|
43
|
+
private
|
44
44
|
def output(message)
|
45
45
|
time = Time.new
|
46
46
|
add = time.strftime("%d-%m-%Y %H:%M:%S")
|
47
|
-
puts "#{time} :: #{message}"
|
47
|
+
puts "#{time} :: #{message}" if @messages == true
|
48
48
|
end
|
49
49
|
|
50
50
|
def verify_profileid_or_trade_link_or_steamid(steamid)
|
@@ -92,7 +92,20 @@ module MiscCommands
|
|
92
92
|
return value
|
93
93
|
end
|
94
94
|
|
95
|
-
|
95
|
+
def api_call(request_methode, interface, api_methode ,version,params = nil)
|
96
|
+
url = ["https://api.steampowered.com","#{interface}", "#{api_methode}", "#{version}"].join('/')
|
97
|
+
if request_methode.downcase == "get"
|
98
|
+
response = @session.get(url, params)
|
99
|
+
elsif request_methode.downcase == "post"
|
100
|
+
response = @session.get(url,params)
|
101
|
+
else
|
102
|
+
raise "invalid request methode : #{request_methode}"
|
103
|
+
end
|
104
|
+
if response.content.include?("Access is denied")
|
105
|
+
raise "invalid API_key"
|
106
|
+
end
|
107
|
+
return response.content
|
108
|
+
end
|
96
109
|
|
97
110
|
|
98
111
|
end
|
data/lib/Trade.rb
CHANGED
@@ -59,7 +59,7 @@ module TradeCommands
|
|
59
59
|
{'Referer' => 'https://steamcommunity.com/tradeoffer/new', 'Origin' => 'https://steamcommunity.com'}
|
60
60
|
)
|
61
61
|
response = JSON.parse(send.body)
|
62
|
-
|
62
|
+
output "trade offer sent ID:: " + response["tradeofferid"] + " to #{persona}"
|
63
63
|
if response["needs_mobile_confirmation"] == true
|
64
64
|
if @identity_secret != nil && @steamid != nil
|
65
65
|
responsehash = response.merge(send_trade_allow_request(response["tradeofferid"]))
|
@@ -71,6 +71,29 @@ module TradeCommands
|
|
71
71
|
end
|
72
72
|
|
73
73
|
end
|
74
|
+
|
75
|
+
|
76
|
+
|
77
|
+
def get_trade_offers()
|
78
|
+
params = {'key'=> @api_key,
|
79
|
+
'get_sent_offers'=> 1,
|
80
|
+
'get_received_offers'=> 1,
|
81
|
+
'get_descriptions'=> 1,
|
82
|
+
'language'=> 'english',
|
83
|
+
'active_only'=> 1,
|
84
|
+
'historical_only'=> 0,
|
85
|
+
'time_historical_cutoff'=> ''}
|
86
|
+
response = api_call('GET', 'IEconService', 'GetTradeOffers', 'v1', params).json()
|
87
|
+
end
|
88
|
+
|
89
|
+
|
90
|
+
|
91
|
+
|
92
|
+
|
93
|
+
|
94
|
+
|
95
|
+
|
96
|
+
|
74
97
|
private
|
75
98
|
|
76
99
|
def verify_friendship(steamid)
|
data/lib/meta/version.rb
CHANGED
data/lib/steam-trade.rb
CHANGED
@@ -6,15 +6,16 @@ require 'open-uri'
|
|
6
6
|
require 'thread'
|
7
7
|
|
8
8
|
|
9
|
-
require_relative 'LoginExecutor.rb'
|
10
|
-
require_relative 'Misc.rb'
|
11
|
-
require_relative 'Trade.rb'
|
12
|
-
require_relative 'Confirmation.rb'
|
13
|
-
require_relative 'Trade.rb'
|
14
|
-
require_relative 'Inventory.rb'
|
15
|
-
require_relative 'Badge.rb'
|
16
|
-
require_relative 'Guard.rb'
|
17
|
-
require_relative 'Playerinfo.rb'
|
9
|
+
require_relative './LoginExecutor.rb'
|
10
|
+
require_relative './Misc.rb'
|
11
|
+
require_relative './Trade.rb'
|
12
|
+
require_relative './Confirmation.rb'
|
13
|
+
require_relative './Trade.rb'
|
14
|
+
require_relative './Inventory.rb'
|
15
|
+
require_relative './Badge.rb'
|
16
|
+
require_relative './Guard.rb'
|
17
|
+
require_relative './Playerinfo.rb'
|
18
|
+
require_relative './IEconService.rb'
|
18
19
|
|
19
20
|
class Handler
|
20
21
|
include MiscCommands
|
@@ -26,6 +27,7 @@ class Handler
|
|
26
27
|
include BadgeCommands
|
27
28
|
include GuardCommands
|
28
29
|
include PlayerCommands
|
30
|
+
include TradeAPI
|
29
31
|
|
30
32
|
def initialize(username = nil ,password = nil,secret = nil)
|
31
33
|
@loggedin = false # will be set to true once we login
|
@@ -45,7 +47,8 @@ class Handler
|
|
45
47
|
|
46
48
|
@inventory_cache = false
|
47
49
|
@libdir = Util.gem_libdir
|
48
|
-
|
50
|
+
@messages = true
|
51
|
+
output "Handler started for #{@username}"
|
49
52
|
if username != nil && password != nil
|
50
53
|
login()
|
51
54
|
end
|
@@ -78,4 +81,14 @@ class Handler
|
|
78
81
|
@api_key = api_key
|
79
82
|
end
|
80
83
|
|
84
|
+
def toggle_messages()
|
85
|
+
if @messages == true
|
86
|
+
output "messages are now disabled"
|
87
|
+
@messages = false
|
88
|
+
else
|
89
|
+
@messages = true
|
90
|
+
output "messages are now enabled"
|
91
|
+
end
|
92
|
+
end
|
93
|
+
|
81
94
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: steam-trade
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- OmG3r
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-04-
|
11
|
+
date: 2018-04-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -76,6 +76,7 @@ files:
|
|
76
76
|
- lib/Badge.rb
|
77
77
|
- lib/Confirmation.rb
|
78
78
|
- lib/Guard.rb
|
79
|
+
- lib/IEconService.rb
|
79
80
|
- lib/Inventory.rb
|
80
81
|
- lib/LoginExecutor.rb
|
81
82
|
- lib/Misc.rb
|