steam-trade 0.0.6 → 0.0.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 404b1b0e1b292caf96982ace83d1ff76f89f3b0e
4
- data.tar.gz: 8fe1386619ccff5c5a070fd6f288f00b4b9dfefd
3
+ metadata.gz: f20feb741d724519d915007de15eddc3e1a81599
4
+ data.tar.gz: c216926c3ea7d6e3791989a791e9700ad3b2b61c
5
5
  SHA512:
6
- metadata.gz: 4bd56dbd81304329324d0bfb95d9c96fabdd4352f4f38287a1420d8e679b7c4fa492a9647b7cc6b67f67be87074511ce0551db7f20f947f36d3b2538b207290e
7
- data.tar.gz: d22b417c694361138746a5bc0edc93bfb537d955983d584fc88d81f267748d13977a02a602f18f8d0d4e653081e889b624e8c02901e2a8ba0836313102640f27
6
+ metadata.gz: 6a05daa45a9863bde39e6d52a07fc970d2f38ef29ad7a234f2254a0fdd53271c68d664c21418b5e2181d78469802bd4ed33aef6048097abf247da980c5278236
7
+ data.tar.gz: abf90deee409d5a191a3a85f27de97128f6a99e2580b6b6d8058fcf0f0327f20205a107411d8f82a80e2efe9524508269648642063ad6d7cd14559fac8e24197
data/README.md CHANGED
@@ -27,6 +27,14 @@ account = Handler.new('username','password','shared_secret') # share secret is o
27
27
  account.mobile_info('identity_secret')
28
28
  #identity_secret is required
29
29
 
30
+ ```
31
+ keep in mind you can initialize a Handler without params however the commands you will be able to use will be limited
32
+ ```ruby
33
+ require 'steam-trade'
34
+
35
+ account = Handler.new()
36
+ puts account.fa('v3dWNq2Ncutc7RelwRVXswT8CJX=v3dWNq2Ncutc7WelwRVXswT8CJk=') => random code
37
+
30
38
  ```
31
39
  ## Getting someone's inventory
32
40
  #### `normal_get_inventory('steamid','inventoryappid')`
@@ -39,18 +47,31 @@ require 'steam-trade'
39
47
 
40
48
  account = Handler.new('username','password','shared_secret')
41
49
  account.mobile_info('identity_secret')
50
+ # while logged in
51
+ my_inventory = normal_get_inventory() #will get your normal inventory(753) if you are logged in else raise an exception
52
+ my_inventory = normal_get_inventory('730') # will get your CS:GO inventory if you are logged in else raise an exeception
42
53
 
43
- my_inventory = normal_get_inventory() #if you are logged in you can call this command with no parameters to get the logged account's inventory
54
+ #while not logged in
55
+ my_inventory = normal_get_inventory() #will raise an exception
56
+ my_inventory = normal_get_inventory('730') #will raise an exception
44
57
 
45
- partner_inventory = normal_get_inventory('76561198044170935') using steamid
58
+ #whenever
59
+ partner_inventory = normal_get_inventory('76561198044170935') #using steamid
46
60
  partner_inventory = normal_get_inventory('https://steamcommunity.com/tradeoffer/new/?partner=410155236&token=H-yK-GFt') #using trade link
47
- partner_inventory = normal_get_inventory('76561198044170935',)
61
+ partner_inventory = normal_get_inventory('CardExchange') #using profile id
62
+
63
+
64
+ partner_inventory = normal_get_inventory('76561198044170935',730) #will get that steamid CS:GO inventory
65
+ partner_inventory = normal_get_inventory('https://steamcommunity.com/tradeoffer/new/?partner=410155236&token=H-yK-GFt', '730') #will get that trade link owner's CS:GO inventory
66
+ partner_inventory = normal_get_inventory('CardExchange',730) # will get CardExchange's CS:GO inventory
67
+
68
+
48
69
  ```
49
70
  the returned items from `normal_get_inventory()` are in the form of an array example : `[item1,item2,item3...itemN]`.
50
71
 
51
72
  each item is a hash which contains information about the item in the form of `{"appid"=>'xxx',"contextid"=>'xxx',"assetid" => 'xxx',"classid"=> 'xxx',......"name"=> 'xxxx',"market_fee_app" => 'xxx',....}`.
52
73
 
53
- `market_fee_app` key gives you the appid of the game's app ( for trading cards), for other items technically `inventoryappid` is the games appid.
74
+ `market_fee_app` key gives you the appid of the game's app (for trading cards), for other items technically `inventoryappid` is the games appid.
54
75
 
55
76
  `name` key gives you the item name.
56
77
  #### `set_inventory_cache()`
@@ -13,7 +13,7 @@ module BadgeCommands
13
13
  raise "You are not logged in and did not specify a steamid"
14
14
  end
15
15
 
16
- steamid = verify_profileid_or_trade_link_or_steamid(steamid)
16
+ steamid,token = verify_profileid_or_trade_link_or_steamid(steamid)
17
17
  thread = Thread.new(steamid) { |steamid| ##getting name
18
18
  targetname = ''
19
19
  begin
@@ -15,7 +15,6 @@ module InventoryCommands
15
15
 
16
16
  #verify given appid only
17
17
  if (3..6).to_a.include?(steamid.to_i.to_s.length)
18
- puts "we got an appid"
19
18
  raise "You cannot give an appid only if you are not logged in" if @steamid == nil
20
19
  appid = steamid.to_s
21
20
  steamid = @steamid
@@ -24,7 +23,6 @@ module InventoryCommands
24
23
 
25
24
  #verify given another game
26
25
  if appid.to_s != "753"
27
- puts "getting a new game"
28
26
  context = 2
29
27
  end
30
28
  #end verify given another game
@@ -32,7 +30,7 @@ module InventoryCommands
32
30
  #verify trade link
33
31
 
34
32
 
35
- steamid = verify_profileid_or_trade_link_or_steamid(steamid)
33
+ steamid,token = verify_profileid_or_trade_link_or_steamid(steamid)
36
34
 
37
35
  raise "invalid steamid : #{steamid}, length of received :: #{steamid.to_s.length}, normal is 17" if steamid.to_s.length != 17
38
36
  ## verify appid
@@ -48,8 +46,7 @@ module InventoryCommands
48
46
  return verdict
49
47
  end
50
48
  end
51
- puts "steamid :#{steamid}"
52
- puts "appid : #{appid}"
49
+
53
50
 
54
51
  items = []
55
52
  last_id = 0
@@ -118,12 +115,10 @@ module InventoryCommands
118
115
  if File.exists?("./#{steamid}_#{appid}.inventory") == false
119
116
  return false
120
117
  end
121
- puts File.mtime("./#{steamid}_#{appid}.inventory").to_s
122
- puts Time.now.to_s
118
+
123
119
  file_last_time = Time.parse(File.mtime("./#{steamid}_#{appid}.inventory").to_s)
124
120
  current_time = Time.parse(Time.now.to_s)
125
121
  calcule = current_time - file_last_time
126
- puts "difference #{calcule}"
127
122
  if calcule.to_i > @inventory_validity
128
123
  File.delete("./#{steamid}_#{appid}.inventory")
129
124
  return false
@@ -69,12 +69,11 @@ module MiscCommands
69
69
 
70
70
  def verify_profileid_or_trade_link_or_steamid(steamid)
71
71
  if steamid.to_i == 0 && steamid.include?("?partner=") ##supplied trade link
72
- puts "got trade link"
73
72
  partner_raw = steamid.split('partner=',2)[1].split('&',2)[0]
73
+ token = steamid.split('token=', 2)[1]
74
74
  steamid = partner_id_to_steam_id(partner_raw)
75
- return steamid
75
+ return [steamid,token]
76
76
  elsif steamid.to_i == 0
77
- puts "got profileid"
78
77
  parser = Nokogiri::XML(@session.get("https://steamcommunity.com/id/#{steamid}?xml=1").content)
79
78
  if parser.xpath('//error').text == ('The specified profile could not be found.')
80
79
  raise "No profile with #{steamid} as profileid"
@@ -5,13 +5,9 @@ module TradeCommands
5
5
  raise "no account logged in, #{self} " if @loggedin == false
6
6
 
7
7
 
8
- token = nil
9
- if link.to_i == 0
10
- partner_raw = link.split('partner=',2)[1].split('&',2)[0]
11
- partner_steamid = partner_id_to_steam_id(partner_raw)
12
- token = link.split('token=', 2)[1]
13
- else ## link is steamid
14
- partner_steamid = link
8
+
9
+ partner_steamid,token = verify_profileid_or_trade_link_or_steamid(link)
10
+ if token == nil
15
11
  verdict = verify_friendship(partner_steamid)
16
12
  persona = verdict["accountname"]
17
13
  if verdict["success"] == false
@@ -20,12 +16,11 @@ module TradeCommands
20
16
  end
21
17
 
22
18
 
19
+
23
20
  theirs = clean_items(they)
24
- print theirs
25
- puts ""
21
+
26
22
  me = clean_items(mine)
27
- print mine
28
- puts ""
23
+
29
24
 
30
25
  sessionid = sessionid_cookie()
31
26
 
@@ -1,4 +1,4 @@
1
1
  module Meta
2
- VERSION = "0.0.6"
2
+ VERSION = "0.0.7"
3
3
  GEM_NAME = "steam-trade"
4
4
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: steam-trade
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.6
4
+ version: 0.0.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - OmG3r