steam-trade 0.3.1 → 0.3.2

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
  SHA256:
3
- metadata.gz: 319222a05152b82b2f8d4803a0dee45d748880e005de5fb7ec04fef4a9dac1bf
4
- data.tar.gz: 5afe7bf73a00dbea9b8e80c3f074286e200af59b9123a9312711d547f5bb23a3
3
+ metadata.gz: d36bb8bbc019b319d60a959e52cefaf5c9015bcefbf2d1e8470c394e156be485
4
+ data.tar.gz: 70cf873bf9180da48cc2507adc3082c2b04f581fa3d8ed73a5572cd43e8c9bdf
5
5
  SHA512:
6
- metadata.gz: 5f5bdda6509a53c989ec2a2e9e830ea1f5e4a9cc07d0e5d28880e08071adcf3d77eb833db6719372a346771e34cdc9659a432ac3675d4e0730c85f0210511fd0
7
- data.tar.gz: 755aeeb8489e8651985406ea6996a47d01567141e4316499e2c1503061b9825fbd814e04f8f4d8eb8cf3731ade018335a0cafcebc1ecf673ef059957412a377e
6
+ metadata.gz: a3a374967d43a7f287575ad94a3b237a0e8bbc470b668bbd873e12ccecc7b574c6223817e3a598d3c340436a374ee7d2eee9624f8056c9171b67e3e19350ea11
7
+ data.tar.gz: 23b36cc7026587dc7f2f9914d93a6f264553be741399f206681b41385520b436efa4bc11acb2b128c47bf29ac79a9f97e2c5b86b93551fe811c8e22fcfa8b087
data/.gitignore ADDED
@@ -0,0 +1,10 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /_yardoc/
4
+ /coverage/
5
+ /doc/
6
+ /pkg/
7
+ /spec/reports/
8
+ /tmp/
9
+ *gem
10
+ git.txt
data/README.md CHANGED
@@ -1,15 +1,18 @@
1
- # steam-trade V0.3.0
1
+ # steam-trade V0.3.2
2
2
 
3
3
  **PLEASE IF SOMETHING DOES NOT WORK PROPERLY MAKE A GITHUB ISSUE**
4
4
 
5
- Please check constantly for updates cause i'm still making this gem.
6
-
7
5
  This gem simplifes/allows sending steam trade offers programmatically.
8
6
 
9
7
  this gem is primarly for trading cards, tho can be used to CS:GO and other games inventories
10
8
 
11
9
  # Changelog
12
10
  ```
11
+ 0.3.2:
12
+ - added send_trade_allow_request() (mobile confirmation) and confirm_all() (mobile confirmation)
13
+ 0.3.1:
14
+ - added cottage() , vote_2018() and sell_items()
15
+
13
16
  0.3.0:
14
17
  - hotfix for cookie login
15
18
 
@@ -94,6 +97,8 @@ this gem is primarly for trading cards, tho can be used to CS:GO and other games
94
97
  - [set_inventory_cache()](#set_inventory_cache)
95
98
  - [Sending a trade offer](#sending-a-trade-offer)
96
99
  - [send_offer()](#send_offermyarraytheirarraytrade_offer_linkmessage)
100
+ - [send_trade_allow_request()](#send_trade_allow_requesttrade_offer_id)
101
+ - [confirm_all()](#confirm_all)
97
102
  - [Handling Trade Offers](#handling-trade-offers)
98
103
  - [set_api_key()](#set_api_keyapi_key)
99
104
  - [get_trade_offers()](#get_trade_offerstime)
@@ -323,6 +328,8 @@ then you can send your offer
323
328
  - `message` is the comment you want to include in the trade offer
324
329
 
325
330
  - `myarray`, `theirarray`, `trade_offer_link` are required, `message` is optional
331
+ - **returns a hash which contains informations about the trade**
332
+ - **identity_secret** is required for this function to work
326
333
  ```ruby
327
334
  require 'steam-trade'
328
335
 
@@ -336,13 +343,48 @@ myarray = [me[5] , me[20] , me[60]].compact!
336
343
  theirarray = [his[1], his[20], his[30]].compact!
337
344
 
338
345
  # if you are friends
339
- account.send_offer(myarray,theirarray,"nomg3r",message)
346
+ resp = account.send_offer(myarray,theirarray,"nomg3r",message)
340
347
  #or (as friends)
341
348
  account.send_offer(myarray,theirarray,'76561198370420964',message)
342
349
 
343
350
  # whenever
344
351
  account.send_offer(myarray,theirarray,"https://steamcommunity.com/tradeoffer/new/?partner=410155236&token=H-yK-GFt",message)
345
352
 
353
+
354
+ ```
355
+
356
+ #### `send_trade_allow_request(trade_offer_id)`
357
+ - `trade_offer_id` is the ID of the offer you want to confirm (mobile confirmation)
358
+ - **identity_secret** is required for this function to work
359
+ ```ruby
360
+ require 'steam-trade'
361
+
362
+ account = Handler.new('username','password','shared_secret')
363
+ account.mobile_info('identity_secret')
364
+
365
+ me = account.normal_get_inventory()
366
+ his = account.normal_get_inventory("nomg3r")
367
+
368
+ myarray = [me[5] , me[20] , me[60]].compact!
369
+ theirarray = [his[1], his[20], his[30]].compact!
370
+
371
+ resp = account.send_offer(myarray,theirarray,"nomg3r",message)
372
+
373
+ account.send_trade_allow_request(resp['trade_offer_id'])
374
+
375
+ ```
376
+
377
+ #### `confirm_all()`
378
+ - confirms all trades which are waiting for mobile confirmation
379
+ - **identity_secret** is required for this function to work
380
+
381
+ ```ruby
382
+ require 'steam-trade'
383
+
384
+ account = Handler.new('username','password','shared_secret')
385
+ account.mobile_info('identity_secret')
386
+
387
+ account.confirm_all
346
388
  ```
347
389
  ## Handling Trade Offers
348
390
  you might want to read [Steam Trading API](https://developer.valvesoftware.com/wiki/Steam_Web_API/IEconService)
data/lib/Confirmation.rb CHANGED
@@ -13,6 +13,9 @@ module ConfirmationCommands
13
13
  send_confirmation(confirmationhash) #tenth
14
14
  end
15
15
 
16
+ def confirm_all()
17
+ send_array_confirmation(get_confirmations())
18
+ end
16
19
  private
17
20
  def get_confirmations() ##SECOND
18
21
  confirmations = []
@@ -61,6 +64,7 @@ module ConfirmationCommands
61
64
 
62
65
 
63
66
  def select_trade_offer_confirmation(trade_id, confirmations) ## seventh
67
+
64
68
  confirmations.each { |confirmhash|
65
69
  confirmation_details_page = fetch_confirmation_details_page(confirmhash) ## eighteth
66
70
  confirm_id = get_confirmation_trade_offer_id(confirmation_details_page) ## nineth
@@ -99,4 +103,30 @@ module ConfirmationCommands
99
103
  return JSON.parse(page.content)
100
104
  end
101
105
 
106
+
107
+
108
+ def send_array_confirmation(conf_array)
109
+ i = 0
110
+ conf_array.each { |confirmationhash|
111
+ begin
112
+ tag = 'allow'
113
+ params = create_confirmation_params('conf') ## EXISTS
114
+ params['op'] = tag
115
+ params['cid'] = confirmationhash["data_confid"]
116
+ params['ck'] = confirmationhash["data_key"]
117
+ headers = {'X-Requested-With' => 'XMLHttpRequest'}
118
+ #@session.pre_connect_hooks << lambda do |agent, request|
119
+ # request['X-Requested-With'] = 'XMLHttpRequest'
120
+ #end
121
+ no = nil
122
+ page = @session.get('https://steamcommunity.com/mobileconf/ajaxop', params,no ,headers)
123
+ i = i + 1
124
+ puts "confirmed #{i} / #{cof_array.length}"
125
+ rescue
126
+ sleep(2)
127
+ end
128
+ }
129
+
130
+ end
131
+
102
132
  end
data/lib/Guard.rb CHANGED
@@ -75,6 +75,7 @@ module GuardCommands
75
75
  if @android_id.nil?
76
76
  hexed = Digest::SHA1.hexdigest(@steamid.to_s)
77
77
  res = 'android:' + [hexed[0..7],hexed[8..11],hexed[12..15],hexed[16..19],hexed[20..31]].join('-')
78
+ @android_id = res
78
79
  return res
79
80
  else
80
81
  return @android_id
data/lib/Trade.rb CHANGED
@@ -94,7 +94,7 @@ module TradeCommands
94
94
 
95
95
  def sell_items(items, price)
96
96
  raise "no account logged in, #{self} " if @loggedin == false
97
- raise "Must given array" if items.class != Array
97
+ raise "Must be given an array" if items.class != Array
98
98
 
99
99
 
100
100
  headers = {
@@ -102,17 +102,17 @@ module TradeCommands
102
102
  'Referer' => 'https://steamcommunity.com/id/SimplifiedPact/inventory/',
103
103
  'User-Agent' => 'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/67.0.3396.87 Safari/537.36 OPR/54.0.2952.54',
104
104
  }
105
-
105
+ i = 0
106
106
  items.each { |asset|
107
107
 
108
108
  asset['sessionid'] = sessionid_cookie()
109
109
  asset['price'] = price
110
110
  verd = {'sucess' => false}
111
111
  tries = 0
112
- i = 0
112
+
113
113
  until verd['success'] == true || tries == 2
114
+ puts "attempting to sell"
114
115
  resp = @session.post('https://steamcommunity.com/market/sellitem/', asset, headers)
115
-
116
116
  verd = JSON.parse(resp.content)
117
117
 
118
118
  if verd['success'] == false
@@ -120,11 +120,13 @@ module TradeCommands
120
120
  tries += 1
121
121
  sleep(10)
122
122
  else
123
+ puts verd
123
124
  i += 1
124
125
  puts "#{i} / #{items.length} sold"
126
+ sleep(1)
125
127
  end
128
+
126
129
  end
127
- sleep(1)
128
130
  }
129
131
  end
130
132
 
data/lib/meta/version.rb CHANGED
@@ -1,4 +1,4 @@
1
1
  module Meta
2
- VERSION = "0.3.1"
2
+ VERSION = "0.3.2"
3
3
  GEM_NAME = "steam-trade"
4
4
  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.3.1
4
+ version: 0.3.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - OmG3r
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2018-12-22 00:00:00.000000000 Z
11
+ date: 2019-01-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -66,6 +66,7 @@ executables: []
66
66
  extensions: []
67
67
  extra_rdoc_files: []
68
68
  files:
69
+ - ".gitignore"
69
70
  - Gemfile
70
71
  - LICENSE
71
72
  - README.md