reso_web_api 0.2.1 → 0.2.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
  SHA1:
3
- metadata.gz: 67631df91f672fae2f93f55775fe0428cd9499c2
4
- data.tar.gz: ff3124a85d13350d727091124f6b1a26505192ff
3
+ metadata.gz: 4501a96c3557146c1a1154fdaaacc285dc5997a6
4
+ data.tar.gz: 27192bff4c4fab933e245e73fdf5bbe6d0d345f3
5
5
  SHA512:
6
- metadata.gz: 0ec818165bb57a2aaa96f7648d8926d4d2970f9b44fc7e0f4fb08104507cd42946291e968eb1503c4d06bf9d86ddc46561dba9d37b38cf372c99ae92e53e055c
7
- data.tar.gz: 42b196b79c5e818acea12e690a664fc35e51d922c4447d6264b083ddd53f18d9ec20821664cef9476b4c8e13ea94a1eaf4f0b1e91114290087f3a03cd59d99a6
6
+ metadata.gz: 64323dbece9426f3690e354c60362a6487c5c55116c251efaf80a0bd630f9beeb907a0c98a4a20e8d1b300812b540aff58197dce2fd67da0b9c231e75d9afdd0
7
+ data.tar.gz: 432e8d6e25e1873e6c38a297a9b8dfcb2ab041f4f36a570ec2583d5b6e26f91e29189d861d8817eff0b161f0f606dc99e73adb03a2cd3115907f776300d375a1
@@ -1,5 +1,11 @@
1
1
  # CHANGELOG
2
2
 
3
+ ## 0.2.2
4
+
5
+ * Switching to frodata gem
6
+ * Make headers configurable, remove default accept header
7
+ * Don't modify passed-in options hash
8
+
3
9
  ## 0.2.1
4
10
 
5
11
  * Added `SimpleTokenAuth` strategy for using basic non-expiring, non-refreshable tokens
data/README.md CHANGED
@@ -69,6 +69,7 @@ However, if you need more control, there are several additional settings that ca
69
69
 
70
70
  - `:user_agent`: Sets the `User-Agent` header sent to the service (defaults to `Reso Web API Ruby Gem $VERSION`)
71
71
  - `:adapter`: Sets the Faraday adapter used for the connection (defaults to `Net::HTTP`)
72
+ - `:header`: Allows custom headers to be set on the connection.
72
73
  - `:logger`: You may pass your own logger to a client instance. By default, each instance will use the global logger defined on the `ResoWebApi` module, which logs to STDOUT. You can also change the logger on the module itself, which will then be used for all new client instances you create.
73
74
  - `:odata`: If you need to pass any special options to the OData service, you may do so here.
74
75
 
@@ -1,6 +1,6 @@
1
1
  require 'json'
2
2
  require 'logger'
3
- require 'odata4'
3
+ require 'frodata'
4
4
 
5
5
  require 'reso_web_api/version'
6
6
  require 'reso_web_api/errors'
@@ -7,9 +7,10 @@ module ResoWebApi
7
7
  extend Dry::Initializer
8
8
 
9
9
  option :endpoint
10
- option :user_agent, default: proc { USER_AGENT }
11
10
  option :adapter, default: proc { Faraday::default_adapter }
11
+ option :headers, default: proc { {} }
12
12
  option :logger, default: proc { ResoWebApi.logger }
13
+ option :user_agent, default: proc { USER_AGENT }
13
14
 
14
15
  USER_AGENT = "Reso Web API Ruby Gem v#{VERSION}"
15
16
 
@@ -30,7 +31,7 @@ module ResoWebApi
30
31
  def headers
31
32
  {
32
33
  :user_agent => user_agent
33
- }
34
+ }.merge(@headers)
34
35
  end
35
36
  end
36
37
  end
@@ -17,12 +17,6 @@ module ResoWebApi
17
17
  ensure_valid_auth_strategy!
18
18
  end
19
19
 
20
- # Headers to be send along with requests
21
- # @return [Hash] The request headers
22
- def headers
23
- super.merge({ accept: 'application/json' })
24
- end
25
-
26
20
  # Return the {Faraday::Connection} object for this client.
27
21
  # Yields the connection object being constructed (for customzing middleware).
28
22
  # @return [Faraday::Connection] The connection object
@@ -33,12 +27,12 @@ module ResoWebApi
33
27
  end
34
28
  end
35
29
 
36
- # Returns a proxied {OData4::Service} that attempts to ensure a properly
30
+ # Returns a proxied {FrOData::Service} that attempts to ensure a properly
37
31
  # authenticated and authorized connection
38
- # @return [OData4::Service] The service instance.
32
+ # @return [FrOData::Service] The service instance.
39
33
  def service
40
34
  # puts odata, service_options
41
- @service ||= OData4::Service.new(connection, service_options)
35
+ @service ||= FrOData::Service.new(connection, service_options)
42
36
  end
43
37
 
44
38
  # Returns the default options used by the by the OData service
@@ -51,7 +45,7 @@ module ResoWebApi
51
45
 
52
46
  def ensure_valid_auth_strategy!
53
47
  if auth.is_a?(Hash)
54
- strategy = auth.delete(:strategy) || Authentication::TokenAuth
48
+ strategy = auth[:strategy] || Authentication::TokenAuth
55
49
  if strategy.is_a?(Class) && strategy <= Authentication::AuthStrategy
56
50
  @auth = strategy.new(auth)
57
51
  else
@@ -1,3 +1,3 @@
1
1
  module ResoWebApi
2
- VERSION = "0.2.1"
2
+ VERSION = "0.2.2"
3
3
  end
@@ -22,7 +22,7 @@ Gem::Specification.new do |spec|
22
22
  spec.require_paths = ["lib"]
23
23
 
24
24
  spec.add_dependency 'faraday', '~> 0.15.0'
25
- spec.add_dependency 'odata4', '~> 0.9.1'
25
+ spec.add_dependency 'frodata', '~> 0.9.2'
26
26
  spec.add_dependency 'dry-initializer', '~> 1.4.1'
27
27
 
28
28
  spec.add_development_dependency "bundler", "~> 1.16"
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: reso_web_api
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
4
+ version: 0.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Christoph Wagner
@@ -25,19 +25,19 @@ dependencies:
25
25
  - !ruby/object:Gem::Version
26
26
  version: 0.15.0
27
27
  - !ruby/object:Gem::Dependency
28
- name: odata4
28
+ name: frodata
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: 0.9.1
33
+ version: 0.9.2
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: 0.9.1
40
+ version: 0.9.2
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: dry-initializer
43
43
  requirement: !ruby/object:Gem::Requirement