oreilly_api 1.0.1 → 1.0.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 331993016d4ab1bced47131d0e70f76e32d8492d66a7a853583a61fef4599600
4
- data.tar.gz: 98931db3b5d41529f7d27a8f31270063c312139796a305bbd531fcae2ba160ec
3
+ metadata.gz: 7eb1943971c134c0817a0a6d0cebf7a960e8d450376a11be451910bb3c28bb28
4
+ data.tar.gz: 1cd243dceb0ceab65ac9e6f16cd6e8e4da0002b7849911f3c14280d2db0b2492
5
5
  SHA512:
6
- metadata.gz: 64869f04d8246537679d62a7c8fdeaaefe362c4a5cb6daa7fa46ba47deebb92de8fda5eb7b8495abd3714e60546c6581a1f0a6195988e5f96f4d2d8cf968f19b
7
- data.tar.gz: b617ee084302e1141c5d78b859759cbaea1b95c05def9360687cd2215f4b31b805b49d535b5b7124325495069852e921c7834ce42c23d1d79d4317c0e5bb4992
6
+ metadata.gz: 1cf84a0a7f5824f5043d6f0f3b292cfd46d5f9786e498d033510d0ca3c2c12b19f76d3c1821c8d42c79746e565f26b99e84f06b382d7c1ed22540830ea0aa20d
7
+ data.tar.gz: 8105641fa782d036e1ebb565a6418147a8ab11f5a02c3367988d5e5705df67b77aca715dfd7d8e0c85be49b44646c085e606864ab402607e4af4e003ddaf0a6e
data/.rspec_status CHANGED
@@ -1,8 +1,8 @@
1
1
  example_id | status | run_time |
2
2
  ------------------------------- | ------- | --------------- |
3
- ./spec/oreilly_api_spec.rb[1:1] | passed | 0.00057 seconds |
4
- ./spec/oreilly_api_spec.rb[1:2] | passed | 0.02444 seconds |
5
- ./spec/oreilly_api_spec.rb[1:3] | passed | 0.00974 seconds |
6
- ./spec/oreilly_api_spec.rb[1:4] | pending | 0.00001 seconds |
7
- ./spec/oreilly_api_spec.rb[1:5] | passed | 0.01098 seconds |
8
- ./spec/oreilly_api_spec.rb[1:6] | passed | 0.00897 seconds |
3
+ ./spec/oreilly_api_spec.rb[1:1] | passed | 0.00312 seconds |
4
+ ./spec/oreilly_api_spec.rb[1:2] | passed | 0.03616 seconds |
5
+ ./spec/oreilly_api_spec.rb[1:3] | passed | 0.01192 seconds |
6
+ ./spec/oreilly_api_spec.rb[1:4] | pending | 0.00002 seconds |
7
+ ./spec/oreilly_api_spec.rb[1:5] | passed | 0.01359 seconds |
8
+ ./spec/oreilly_api_spec.rb[1:6] | passed | 0.01565 seconds |
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- oreilly_api (1.0.1)
4
+ oreilly_api (1.0.2)
5
5
  byebug
6
6
  redis
7
7
  redis_utility
data/Rakefile CHANGED
@@ -10,3 +10,7 @@ require 'rubocop/rake_task'
10
10
  RuboCop::RakeTask.new
11
11
 
12
12
  task default: %i[spec rubocop]
13
+
14
+ task :console do
15
+ exec "irb -r oreilly_api -I ./lib"
16
+ end
@@ -1,3 +1,3 @@
1
1
  module OreillyApi
2
- VERSION = "1.0.1"
2
+ VERSION = "1.0.2"
3
3
  end
data/lib/oreilly_api.rb CHANGED
@@ -8,12 +8,13 @@ require 'redis'
8
8
  require 'redis_utility'
9
9
 
10
10
  # rubocop:disable Metrics/MethodLength
11
+ # rubocop:disable Layout/LineLength
11
12
 
12
13
  # OreillyApi
13
14
  module OreillyApi
14
15
  TOKEN = 'oreilly_api_token'
15
16
  class << self
16
- attr_accessor :domain, :version, :client_id, :client_secret, :identity, :account_number
17
+ attr_accessor :domain, :version, :client_id, :client_secret, :identity, :account_number, :device_id
17
18
 
18
19
  def config
19
20
  yield self
@@ -105,7 +106,7 @@ module OreillyApi
105
106
  }.to_json
106
107
 
107
108
  params = "&client_id=#{OreillyApi.client_id}&client_secret=#{OreillyApi.client_secret}"
108
- url = "#{OreillyApi.domain}/oauth-server/oauth/token?grant_type=client_credentials&device_id=test#{params}"
109
+ url = "#{OreillyApi.domain}/oauth-server/oauth/token?grant_type=client_credentials&device_id=#{OreillyApi.device_id}#{params}"
109
110
  res = RestClient.post(url, payload, { 'Content-Type' => 'application/json' })
110
111
  token_info = JSON.parse(res)
111
112
  @token = token_info['access_token']
@@ -122,4 +123,5 @@ module OreillyApi
122
123
  end
123
124
  end
124
125
  # rubocop:enable Metrics/MethodLength
126
+ # rubocop:enable Layout/LineLength
125
127
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: oreilly_api
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.1
4
+ version: 1.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - TruptiHosmani
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2023-02-08 00:00:00.000000000 Z
11
+ date: 2023-04-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler