reso_transport 1.2.0 → 1.5.1

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: b45ccf4b5c9867e0b0321837c60b9d02132500287e4c7b8da0f4778055f187eb
4
- data.tar.gz: 6bf1974a3a47e6992436a44189cec2d3b0d09111b5db8b9460962395699fd2d1
3
+ metadata.gz: 3d0f1d48b90a3fac473d2fc548626f619a1389814fe476db23bb0e12113ee84d
4
+ data.tar.gz: 0a61cdc9750832111812de93441beafe29bef47059841e7ea41105589c673373
5
5
  SHA512:
6
- metadata.gz: 0b370d94911dc23c85ed636fa8ec498755e9f45dc1c9bbf881fad758f1441b68c166ead9e9011a31835437efcf2cb46b97a5b2ecc4ed1c45e4889ebf32b0e5b7
7
- data.tar.gz: d0a446c18da53056591f581ec613d44727a01269fc8de44001611100c5208457168d89c6a882b4ba7c8aa3b1a8b2e84a77f7bd1e4597b4bc90f4b0fddf3f94e3
6
+ metadata.gz: 96b56e7e821e978b4ff48f9023d82901c4449eb820f3b0ab82e9faa187b8c7e547dbef679a396c6385202f713aeaf8c446e2d1338b46e2c09f32632ab6e04d6a
7
+ data.tar.gz: c054fa510a18b072a4e98505d48d73fb9bde7c06e3294aaafe9fcf7c28b94cd0ffb0e51019ea5b6b6630783584bcbde5e49a4abfa0d9fecebb45567bcab79308
@@ -0,0 +1 @@
1
+ 2.7.1
@@ -1,33 +1,33 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- reso_transport (1.1.0)
5
- faraday (~> 0.15.0)
4
+ reso_transport (1.5.1)
5
+ faraday (~> 1.0.1)
6
6
 
7
7
  GEM
8
8
  remote: https://rubygems.org/
9
9
  specs:
10
10
  byebug (11.0.1)
11
- faraday (0.15.4)
11
+ faraday (1.0.1)
12
12
  multipart-post (>= 1.2, < 3)
13
13
  minitest (5.13.0)
14
14
  minitest-rg (5.2.0)
15
15
  minitest (~> 5.0)
16
16
  multipart-post (2.1.1)
17
- rake (10.5.0)
18
- vcr (5.0.0)
17
+ rake (13.0.1)
18
+ vcr (6.0.0)
19
19
 
20
20
  PLATFORMS
21
21
  ruby
22
22
 
23
23
  DEPENDENCIES
24
- bundler (~> 1.17)
24
+ bundler (~> 2)
25
25
  byebug
26
26
  minitest (~> 5.0)
27
27
  minitest-rg (~> 5.0)
28
- rake (~> 10.0)
28
+ rake (~> 13)
29
29
  reso_transport!
30
- vcr (~> 5.0)
30
+ vcr (~> 6.0)
31
31
 
32
32
  BUNDLED WITH
33
- 1.17.2
33
+ 2.1.4
data/README.md CHANGED
@@ -30,6 +30,25 @@ This gem has been tested to work with:
30
30
  * [Bridge Interactive](https://www.bridgeinteractive.com)
31
31
 
32
32
 
33
+ ### Logging
34
+
35
+ You can either set a global logger in an initializer file:
36
+
37
+ ```ruby
38
+ ResoTransport.configure do |c|
39
+ c.logger = Logger.new("some_log_file")
40
+ # OR
41
+ c.logger = Rails.logger
42
+ end
43
+
44
+ ```
45
+ Or you can set a logger for each specific instance of a client which can be useful for debugging:
46
+
47
+ ```ruby
48
+ @client = ResoTransport::Client.new(config.merge(logger: Logger.new("logfile")))
49
+ ```
50
+
51
+
33
52
  ### Getting Connected
34
53
 
35
54
  There are 2 strategies for authentication.
@@ -189,6 +208,7 @@ After checking out the repo, run `bin/setup` to install dependencies. Then, run
189
208
 
190
209
  To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
191
210
 
211
+
192
212
  ## Contributing
193
213
 
194
214
  Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/reso_transport. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
@@ -22,9 +22,9 @@ require 'byebug'
22
22
 
23
23
  SECRETS = YAML.load_file("secrets.yml")
24
24
 
25
- @trestle = ResoTransport::Client.new(SECRETS[:trestle])
26
- @bridge = ResoTransport::Client.new(SECRETS[:bridge])
27
- @spark = ResoTransport::Client.new(SECRETS[:spark])
25
+ @trestle = ResoTransport::Client.new(SECRETS[:trestle].merge(logger: Logger.new($stdout)))
26
+ @bridge = ResoTransport::Client.new(SECRETS[:bridge].merge(logger: Logger.new($stdout)))
27
+ # @spark = ResoTransport::Client.new(SECRETS[:spark])
28
28
  @crmls = ResoTransport::Client.new(SECRETS[:crmls])
29
29
 
30
30
  IRB.start(__FILE__)
@@ -21,17 +21,19 @@ require "reso_transport/query"
21
21
 
22
22
 
23
23
 
24
- module Faraday
25
- module Utils
24
+ # module Faraday
25
+ # module Utils
26
26
 
27
- def escape(str)
28
- str.to_s.gsub(ESCAPE_RE) do |match|
29
- '%' + match.unpack('H2' * match.bytesize).join('%').upcase
30
- end.gsub(" ","%20")
27
+ # def escape(str)
28
+ # str.to_s.gsub(ESCAPE_RE) do |match|
29
+ # '%' + match.unpack('H2' * match.bytesize).join('%').upcase
30
+ # end.gsub(" ","%20")
31
31
 
32
- end
33
- end
34
- end
32
+ # end
33
+ # end
34
+ # end
35
+
36
+ Faraday::Utils.default_space_encoding = "%20"
35
37
 
36
38
  module ResoTransport
37
39
  class Error < StandardError; end
@@ -8,10 +8,13 @@ module ResoTransport
8
8
  @authentication = ensure_valid_auth_strategy(options.fetch(:authentication))
9
9
  @vendor = options.fetch(:vendor, {})
10
10
  @faraday_options = options.fetch(:faraday_options, {})
11
+ @logger = options.fetch(:logger, nil)
11
12
 
12
13
  @connection = Faraday.new(@endpoint, @faraday_options) do |faraday|
13
14
  faraday.request :url_encoded
14
- faraday.response :logger, ResoTransport.configuration.logger if ResoTransport.configuration.logger
15
+ # faraday.response :logger, ResoTransport.configuration.logger if ResoTransport.configuration.logger
16
+ # faraday.response :logger, @logger if @logger
17
+ faraday.response :logger
15
18
  #yield faraday if block_given?
16
19
  faraday.use Authentication::Middleware, @authentication
17
20
  faraday.adapter Faraday.default_adapter #unless faraday.builder.send(:adapter_set?)
@@ -7,7 +7,7 @@ module ResoTransport
7
7
 
8
8
  Enum = Struct.new(:name, :type, :is_flags) do
9
9
  def self.from_stream(args)
10
- new("#{args[:schema].namespace}.#{args["Name"]}", args["UnderlyingType"], args["IsFlags"])
10
+ new("#{args[:schema].namespace}.#{args["Name"]}", args["UnderlyingType"], args["IsFlags"].to_s.downcase == "true")
11
11
  end
12
12
 
13
13
  def members
@@ -23,7 +23,8 @@ module ResoTransport
23
23
  if File.exist?(client.md_file) && File.size(client.md_file) > 0
24
24
  File.new(client.md_file)
25
25
  else
26
- File.open(client.md_file, "w") {|f| f.write(raw) }
26
+ raw_md = raw
27
+ File.open(client.md_file, "w") {|f| f.write(raw.force_encoding("UTF-8")) } unless raw_md.length == 0
27
28
  File.new(client.md_file)
28
29
  end
29
30
  else
@@ -21,9 +21,9 @@ module ResoTransport
21
21
  def parse_value(value)
22
22
  case data_type
23
23
  when "Edm.DateTimeOffset"
24
- DateTime.parse(value)
24
+ DateTime.parse(value) rescue nil
25
25
  when "Edm.Date"
26
- Date.parse(value)
26
+ Date.parse(value) rescue nil
27
27
  else
28
28
  value
29
29
  end
@@ -1,7 +1,7 @@
1
1
  module ResoTransport
2
2
  Query = Struct.new(:resource) do
3
3
 
4
- def all(&block)
4
+ def all(*contexts, &block)
5
5
  new_query_context('and')
6
6
  instance_eval(&block)
7
7
  clear_query_context
@@ -59,6 +59,7 @@ module ResoTransport
59
59
  end
60
60
 
61
61
  def count
62
+ p compile_params
62
63
  limit(1).include_count
63
64
  resp = resource.get(compile_params)
64
65
  parsed_body = JSON.parse(resp.body)
@@ -117,17 +118,17 @@ module ResoTransport
117
118
  global = groups.delete(:global)
118
119
  filter_groups = groups.values
119
120
 
120
- filter_string = ""
121
+ filter_chunks = []
121
122
 
122
123
  if global && global[:criteria]&.any?
123
- filter_string << global[:criteria].join(" #{global[:context]} ")
124
+ filter_chunks << global[:criteria].join(" #{global[:context]} ")
124
125
  end
125
126
 
126
- filter_string << filter_groups.map do |g|
127
+ filter_chunks << filter_groups.map do |g|
127
128
  "(#{g[:criteria].join(" #{g[:context]} ")})"
128
129
  end.join(" and ")
129
130
 
130
- filter_string
131
+ filter_chunks.reject {|c| c == ""}.join(" and ")
131
132
  end
132
133
 
133
134
  def compile_params
@@ -1,3 +1,3 @@
1
1
  module ResoTransport
2
- VERSION = "1.2.0"
2
+ VERSION = "1.5.1"
3
3
  end
@@ -24,12 +24,12 @@ Gem::Specification.new do |spec|
24
24
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
25
25
  spec.require_paths = ["lib"]
26
26
 
27
- spec.add_dependency "faraday", "~> 0.15.0"
27
+ spec.add_dependency "faraday", "~> 1.0.1"
28
28
 
29
- spec.add_development_dependency "bundler", "~> 1.17"
30
- spec.add_development_dependency "rake", "~> 10.0"
29
+ spec.add_development_dependency "bundler", "~> 2"
30
+ spec.add_development_dependency "rake", "~> 13"
31
31
  spec.add_development_dependency "minitest", "~> 5.0"
32
32
  spec.add_development_dependency "minitest-rg", "~> 5.0"
33
- spec.add_development_dependency "vcr", "~> 5.0"
33
+ spec.add_development_dependency "vcr", "~> 6.0"
34
34
  spec.add_development_dependency "byebug"
35
35
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: reso_transport
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.0
4
+ version: 1.5.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jon Druse
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-02-04 00:00:00.000000000 Z
11
+ date: 2020-08-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday
@@ -16,42 +16,42 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: 0.15.0
19
+ version: 1.0.1
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: 0.15.0
26
+ version: 1.0.1
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: bundler
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: '1.17'
33
+ version: '2'
34
34
  type: :development
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: '1.17'
40
+ version: '2'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: rake
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
45
  - - "~>"
46
46
  - !ruby/object:Gem::Version
47
- version: '10.0'
47
+ version: '13'
48
48
  type: :development
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
52
  - - "~>"
53
53
  - !ruby/object:Gem::Version
54
- version: '10.0'
54
+ version: '13'
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: minitest
57
57
  requirement: !ruby/object:Gem::Requirement
@@ -86,14 +86,14 @@ dependencies:
86
86
  requirements:
87
87
  - - "~>"
88
88
  - !ruby/object:Gem::Version
89
- version: '5.0'
89
+ version: '6.0'
90
90
  type: :development
91
91
  prerelease: false
92
92
  version_requirements: !ruby/object:Gem::Requirement
93
93
  requirements:
94
94
  - - "~>"
95
95
  - !ruby/object:Gem::Version
96
- version: '5.0'
96
+ version: '6.0'
97
97
  - !ruby/object:Gem::Dependency
98
98
  name: byebug
99
99
  requirement: !ruby/object:Gem::Requirement
@@ -116,6 +116,7 @@ extensions: []
116
116
  extra_rdoc_files: []
117
117
  files:
118
118
  - ".gitignore"
119
+ - ".ruby-version"
119
120
  - ".travis.yml"
120
121
  - CODE_OF_CONDUCT.md
121
122
  - Gemfile
@@ -165,7 +166,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
165
166
  - !ruby/object:Gem::Version
166
167
  version: '0'
167
168
  requirements: []
168
- rubygems_version: 3.0.3
169
+ rubygems_version: 3.1.2
169
170
  signing_key:
170
171
  specification_version: 4
171
172
  summary: A utility for consuming RESO Web API connections