reso_web_api 0.2.1 → 0.2.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 +4 -4
- data/CHANGELOG.md +6 -0
- data/README.md +1 -0
- data/lib/reso_web_api.rb +1 -1
- data/lib/reso_web_api/base_client.rb +3 -2
- data/lib/reso_web_api/client.rb +4 -10
- data/lib/reso_web_api/version.rb +1 -1
- data/reso_web_api.gemspec +1 -1
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4501a96c3557146c1a1154fdaaacc285dc5997a6
|
4
|
+
data.tar.gz: 27192bff4c4fab933e245e73fdf5bbe6d0d345f3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 64323dbece9426f3690e354c60362a6487c5c55116c251efaf80a0bd630f9beeb907a0c98a4a20e8d1b300812b540aff58197dce2fd67da0b9c231e75d9afdd0
|
7
|
+
data.tar.gz: 432e8d6e25e1873e6c38a297a9b8dfcb2ab041f4f36a570ec2583d5b6e26f91e29189d861d8817eff0b161f0f606dc99e73adb03a2cd3115907f776300d375a1
|
data/CHANGELOG.md
CHANGED
@@ -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
|
|
data/lib/reso_web_api.rb
CHANGED
@@ -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
|
data/lib/reso_web_api/client.rb
CHANGED
@@ -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 {
|
30
|
+
# Returns a proxied {FrOData::Service} that attempts to ensure a properly
|
37
31
|
# authenticated and authorized connection
|
38
|
-
# @return [
|
32
|
+
# @return [FrOData::Service] The service instance.
|
39
33
|
def service
|
40
34
|
# puts odata, service_options
|
41
|
-
@service ||=
|
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
|
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
|
data/lib/reso_web_api/version.rb
CHANGED
data/reso_web_api.gemspec
CHANGED
@@ -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 '
|
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.
|
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:
|
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.
|
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.
|
40
|
+
version: 0.9.2
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: dry-initializer
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|