beyond_api 0.7.0.pre → 0.7.1.pre

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: 3f7a8343a55357062e3c00e229c0b16c1c88af900347165145739372d005cb99
4
- data.tar.gz: 10ff509e60617197670305f7a0a6a32171018693f4100b8da9626ae636e492ec
3
+ metadata.gz: 6e0129444a024277fbe0f4abee48a66429124bd1a2e6a58111c9de45009a3a33
4
+ data.tar.gz: d2456258eb86285646a5cd0560f76156a54eaea591375c6b3a9a11e85811bbd5
5
5
  SHA512:
6
- metadata.gz: c3edbc6973b4f630cb38ca5c1eb7a4855df7deb85fa43a74315133a4e3df86695955fd5c461ff1d645ad79ea1d1aa296b245c42af2738d16cd0b9ec6fefd9980
7
- data.tar.gz: bdf3dc796e6cbf47981daaf40b71ec83d937213e0640f24ad32c250e0a68ce842205289b9fb6b3290425bc849b334680054516eeda3e2b932c4cfc39f52d0788
6
+ metadata.gz: e068ce40c0df8c695b847d086bb214f4d6b77839743ed1c8284d5be7e765fbeb3d0d6db6757ee6c74aae201765b1e4c47997292100f461cb64cd1608e376395f
7
+ data.tar.gz: 2196eed2089a57bd8eed949b2076d963e079324aaeccb08e5e3bb566e2a6f48c71177e6301d43fcef8aaf83e1a68f08fead959db0d74763da3a0b832899ec4b6
data/CHANGELOG.md CHANGED
@@ -1,3 +1,9 @@
1
+ ### v0.7.1.pre
2
+
3
+ * bug-fixes
4
+ * Allow to create a `BeyondApi::Session` without `access_token` and `refresh_token`
5
+ * Fix no-Rails logger
6
+
1
7
  ### v0.7.0.pre
2
8
 
3
9
  * features
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- beyond_api (0.7.0.pre)
4
+ beyond_api (0.7.1.pre)
5
5
  faraday (~> 0.15)
6
6
 
7
7
  GEM
data/lib/beyond_api.rb CHANGED
@@ -7,6 +7,8 @@ require "beyond_api/session"
7
7
  require "beyond_api/ext"
8
8
  require "beyond_api/utils"
9
9
 
10
+ require "logger"
11
+
10
12
  module BeyondApi
11
13
  class Error < StandardError; end
12
14
 
@@ -9,7 +9,7 @@ module BeyondApi
9
9
  define_method(method) do |session, path, params = {}|
10
10
  response = BeyondApi::Connection.default.send(method) do |request|
11
11
  request.url(session.api_url + path)
12
- request.headers['Authorization'] = "Bearer #{ session.access_token }"
12
+ request.headers['Authorization'] = "Bearer #{ session.access_token }" unless session.access_token.nil?
13
13
  request.params = params.to_h.camelize_keys
14
14
  end
15
15
 
@@ -21,7 +21,7 @@ module BeyondApi
21
21
  define_method(method) do |session, path, body = {}, params = {}|
22
22
  response = BeyondApi::Connection.default.send(method) do |request|
23
23
  request.url(session.api_url + path)
24
- request.headers['Authorization'] = "Bearer #{ session.access_token }"
24
+ request.headers['Authorization'] = "Bearer #{ session.access_token }" unless session.access_token.nil?
25
25
  request.params = params.to_h.camelize_keys
26
26
  request.body = body.camelize_keys.to_json
27
27
  end
@@ -34,7 +34,7 @@ module BeyondApi
34
34
  def self.upload(session, path, file_binary, content_type, params)
35
35
  response = BeyondApi::Connection.default.post do |request|
36
36
  request.url(session.api_url + path)
37
- request.headers['Authorization'] = "Bearer #{ session.access_token }"
37
+ request.headers['Authorization'] = "Bearer #{ session.access_token }" unless session.access_token.nil?
38
38
  request.headers['Content-Type'] = content_type
39
39
  request.params = params.to_h.camelize_keys
40
40
  request.body = file_binary
@@ -8,10 +8,9 @@ module BeyondApi
8
8
 
9
9
  def initialize(session)
10
10
  @session = session
11
- raise InvalidSessionError.new("Invalid session") unless session.is_a? BeyondApi::Session
12
- if session.api_url.nil? || session.access_token.nil? || session.refresh_token.nil?
13
- raise InvalidSessionError.new("Session api_url, access_token and refresh_token cannot be nil")
14
- end
11
+
12
+ raise InvalidSessionError, "Invalid session" unless session.is_a? BeyondApi::Session
13
+ raise InvalidSessionError, "Session api_url cannot be nil" if session.api_url.nil?
15
14
  end
16
15
  end
17
16
  end
@@ -1,3 +1,3 @@
1
1
  module BeyondApi
2
- VERSION = "0.7.0.pre".freeze
2
+ VERSION = "0.7.1.pre".freeze
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: beyond_api
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.0.pre
4
+ version: 0.7.1.pre
5
5
  platform: ruby
6
6
  authors:
7
7
  - Unai Abrisketa
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: exe
12
12
  cert_chain: []
13
- date: 2020-02-13 00:00:00.000000000 Z
13
+ date: 2020-02-20 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: bundler