lurch 0.2.0 → 0.3.0

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
- SHA1:
3
- metadata.gz: c8fb6274173704bb0f17e22796c50ecbb4fe75b0
4
- data.tar.gz: 06ee7c2aefa1d85d083520d5b008ed30b689e4b4
2
+ SHA256:
3
+ metadata.gz: ef2a3000fed039297ab171d4141121f2b38ffd0e44615213b6b871c42523b4d8
4
+ data.tar.gz: a91710a41da277b9202512bf2cd660d2b20c6e70e6d344e0dde77ee6e0468ad5
5
5
  SHA512:
6
- metadata.gz: 5586c71bb63f79f4887ce86e18ce1884f55a680ec18e26f9a10be9a18405fc6f5b72c6f63200b554a5cb168d71fce8a4b63a6fddafb55f73a4fe5a8ffc056d2c
7
- data.tar.gz: fa90e2c7b33df39e6d0c4e87b63471c770d109b56faca9d3bfa64ebf764077b5e472d393fb728c98f26fd75cca870d3904c60ee808954bba2add4ad837e998ab
6
+ metadata.gz: 947198331bee106ef4231bc11b4be0847295a6e8ea9c54bca4f708e1c2093e9af00eb5b8ae3f2a26da341746f6b3ae661cd3d15d14087df2bddbc13cb1e87299
7
+ data.tar.gz: 26e972e0c55673097818d701143c88750364f38ad6d063f7704b16226999d0f07f2a4d6c3f9f67fa0e08f54e7089553d772517c66f0a7ff756b9c90ec75f75e4
data/.travis.yml CHANGED
@@ -4,4 +4,8 @@ rvm:
4
4
  - 2.2
5
5
  - 2.3
6
6
  - 2.4
7
+ - 2.5
7
8
  cache: bundler
9
+ before_install:
10
+ - gem update --system
11
+ - gem install bundler
data/CHANGELOG.md CHANGED
@@ -6,6 +6,10 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
6
6
 
7
7
  ## [Unreleased][]
8
8
 
9
+ ## [0.3.0][] - 2018-05-31
10
+ ### Fixed
11
+ - Query parameters like `"foo[0][bar]=one&foo[1][bar]=two"` being turned into `"foo[][bar]=one&foo[][bar]=two"`
12
+
9
13
  ## [0.2.0][] - 2017-11-04
10
14
  ### Fixed
11
15
  - Better error handling; server response status code is now always included in the exception message.
@@ -14,5 +18,6 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
14
18
  ## 0.1.0 - 2017-10-30
15
19
  ### Initial public release
16
20
 
17
- [Unreleased]: https://github.com/peek-travel/cocktail/compare/0.2.0...HEAD
18
- [0.2.0]: https://github.com/peek-travel/cocktail/compare/0.1.0...0.2.0
21
+ [Unreleased]: https://github.com/peek-travel/lurch/compare/0.3.0...HEAD
22
+ [0.3.0]: https://github.com/peek-travel/lurch/compare/0.2.0...0.3.0
23
+ [0.2.0]: https://github.com/peek-travel/lurch/compare/0.1.0...0.2.0
data/lib/lurch.rb CHANGED
@@ -1,6 +1,7 @@
1
1
  require "uri"
2
2
 
3
3
  require "inflecto"
4
+ require "rack"
4
5
  require "faraday"
5
6
  require "typhoeus"
6
7
  require "typhoeus/adapters/faraday"
@@ -40,6 +41,7 @@ require "lurch/query_builder"
40
41
  require "lurch/payload_builder"
41
42
  require "lurch/query"
42
43
  require "lurch/changeset"
44
+ require "lurch/faraday_params_encoder"
43
45
  require "lurch/client"
44
46
  require "lurch/store_configuration"
45
47
  require "lurch/store"
data/lib/lurch/client.rb CHANGED
@@ -80,7 +80,7 @@ module Lurch
80
80
  end
81
81
 
82
82
  def client
83
- @client ||= Faraday.new(url: url) do |conn|
83
+ @client ||= Faraday.new(url: url, request: { params_encoder: FaradayParamsEncoder }) do |conn|
84
84
  conn.headers[AUTHORIZATION] = authorization unless authorization.nil?
85
85
 
86
86
  conn.request :jsonapi
@@ -0,0 +1,11 @@
1
+ module Lurch
2
+ class FaradayParamsEncoder
3
+ def self.encode(params)
4
+ QueryBuilder.new(params).encode
5
+ end
6
+
7
+ def self.decode(query)
8
+ Rack::Utils.parse_nested_query(query)
9
+ end
10
+ end
11
+ end
@@ -5,8 +5,8 @@ module Lurch
5
5
  define_encode_type(types_mode)
6
6
  end
7
7
 
8
- def self.classify(s)
9
- Inflecto.classify(s)
8
+ def self.classify(str)
9
+ Inflecto.classify(str)
10
10
  end
11
11
 
12
12
  def self.decode_key(key)
data/lib/lurch/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Lurch
2
- VERSION = "0.2.0".freeze
2
+ VERSION = "0.3.0".freeze
3
3
  end
data/lurch.gemspec CHANGED
@@ -1,4 +1,4 @@
1
- require File.expand_path("../lib/lurch/version", __FILE__)
1
+ require File.expand_path("lib/lurch/version", __dir__)
2
2
 
3
3
  Gem::Specification.new do |gem|
4
4
  gem.name = "lurch"
@@ -15,12 +15,13 @@ Gem::Specification.new do |gem|
15
15
 
16
16
  gem.add_dependency("faraday", "< 1.0")
17
17
  gem.add_dependency("inflecto", "~> 0.0")
18
+ gem.add_dependency("rack", ">= 1.0")
18
19
  gem.add_dependency("typhoeus", "< 2.0")
19
20
 
20
- gem.add_development_dependency("codecov", "~> 0.1")
21
- gem.add_development_dependency("minitest", "~> 5.9")
22
- gem.add_development_dependency("pry", "~> 0.10")
23
- gem.add_development_dependency("rake", "~> 12.2")
24
- gem.add_development_dependency("rubocop", "~> 0.43")
25
- gem.add_development_dependency("webmock", "~> 3.1")
21
+ gem.add_development_dependency("codecov")
22
+ gem.add_development_dependency("minitest")
23
+ gem.add_development_dependency("pry")
24
+ gem.add_development_dependency("rake")
25
+ gem.add_development_dependency("rubocop")
26
+ gem.add_development_dependency("webmock")
26
27
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lurch
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chris Dosé
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-11-04 00:00:00.000000000 Z
11
+ date: 2018-05-31 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday
@@ -38,6 +38,20 @@ dependencies:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
40
  version: '0.0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rack
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: '1.0'
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: '1.0'
41
55
  - !ruby/object:Gem::Dependency
42
56
  name: typhoeus
43
57
  requirement: !ruby/object:Gem::Requirement
@@ -56,86 +70,86 @@ dependencies:
56
70
  name: codecov
57
71
  requirement: !ruby/object:Gem::Requirement
58
72
  requirements:
59
- - - "~>"
73
+ - - ">="
60
74
  - !ruby/object:Gem::Version
61
- version: '0.1'
75
+ version: '0'
62
76
  type: :development
63
77
  prerelease: false
64
78
  version_requirements: !ruby/object:Gem::Requirement
65
79
  requirements:
66
- - - "~>"
80
+ - - ">="
67
81
  - !ruby/object:Gem::Version
68
- version: '0.1'
82
+ version: '0'
69
83
  - !ruby/object:Gem::Dependency
70
84
  name: minitest
71
85
  requirement: !ruby/object:Gem::Requirement
72
86
  requirements:
73
- - - "~>"
87
+ - - ">="
74
88
  - !ruby/object:Gem::Version
75
- version: '5.9'
89
+ version: '0'
76
90
  type: :development
77
91
  prerelease: false
78
92
  version_requirements: !ruby/object:Gem::Requirement
79
93
  requirements:
80
- - - "~>"
94
+ - - ">="
81
95
  - !ruby/object:Gem::Version
82
- version: '5.9'
96
+ version: '0'
83
97
  - !ruby/object:Gem::Dependency
84
98
  name: pry
85
99
  requirement: !ruby/object:Gem::Requirement
86
100
  requirements:
87
- - - "~>"
101
+ - - ">="
88
102
  - !ruby/object:Gem::Version
89
- version: '0.10'
103
+ version: '0'
90
104
  type: :development
91
105
  prerelease: false
92
106
  version_requirements: !ruby/object:Gem::Requirement
93
107
  requirements:
94
- - - "~>"
108
+ - - ">="
95
109
  - !ruby/object:Gem::Version
96
- version: '0.10'
110
+ version: '0'
97
111
  - !ruby/object:Gem::Dependency
98
112
  name: rake
99
113
  requirement: !ruby/object:Gem::Requirement
100
114
  requirements:
101
- - - "~>"
115
+ - - ">="
102
116
  - !ruby/object:Gem::Version
103
- version: '12.2'
117
+ version: '0'
104
118
  type: :development
105
119
  prerelease: false
106
120
  version_requirements: !ruby/object:Gem::Requirement
107
121
  requirements:
108
- - - "~>"
122
+ - - ">="
109
123
  - !ruby/object:Gem::Version
110
- version: '12.2'
124
+ version: '0'
111
125
  - !ruby/object:Gem::Dependency
112
126
  name: rubocop
113
127
  requirement: !ruby/object:Gem::Requirement
114
128
  requirements:
115
- - - "~>"
129
+ - - ">="
116
130
  - !ruby/object:Gem::Version
117
- version: '0.43'
131
+ version: '0'
118
132
  type: :development
119
133
  prerelease: false
120
134
  version_requirements: !ruby/object:Gem::Requirement
121
135
  requirements:
122
- - - "~>"
136
+ - - ">="
123
137
  - !ruby/object:Gem::Version
124
- version: '0.43'
138
+ version: '0'
125
139
  - !ruby/object:Gem::Dependency
126
140
  name: webmock
127
141
  requirement: !ruby/object:Gem::Requirement
128
142
  requirements:
129
- - - "~>"
143
+ - - ">="
130
144
  - !ruby/object:Gem::Version
131
- version: '3.1'
145
+ version: '0'
132
146
  type: :development
133
147
  prerelease: false
134
148
  version_requirements: !ruby/object:Gem::Requirement
135
149
  requirements:
136
- - - "~>"
150
+ - - ">="
137
151
  - !ruby/object:Gem::Version
138
- version: '3.1'
152
+ version: '0'
139
153
  description: A client library for interacting with JSON API servers, based on http://jsonapi.org/
140
154
  version 1.0.
141
155
  email: chris@peek.com
@@ -172,6 +186,7 @@ files:
172
186
  - lib/lurch/errors/server_error.rb
173
187
  - lib/lurch/errors/unauthorized.rb
174
188
  - lib/lurch/errors/unprocessable_entity.rb
189
+ - lib/lurch/faraday_params_encoder.rb
175
190
  - lib/lurch/inflector.rb
176
191
  - lib/lurch/logger.rb
177
192
  - lib/lurch/middleware/json_api_request.rb
@@ -229,7 +244,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
229
244
  version: '0'
230
245
  requirements: []
231
246
  rubyforge_project:
232
- rubygems_version: 2.6.11
247
+ rubygems_version: 2.7.6
233
248
  signing_key:
234
249
  specification_version: 4
235
250
  summary: A simple Ruby JSON API client