spyke 1.7.0 → 1.7.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
  SHA1:
3
- metadata.gz: b1e4e0a09a6e130d78cdfc11ad4c46baee78c332
4
- data.tar.gz: ef161ce8bdf5013e36e41e5054ac461d58c84b88
3
+ metadata.gz: e6613906c7dbb4e350d7d7bbe598b0775b8283ec
4
+ data.tar.gz: c1532061ab3a9fb149ffcdd23edf6212e489b1cc
5
5
  SHA512:
6
- metadata.gz: bf368cf28410559c6fdc38f3f14c24b28effe957d05249aced614adfcbcb39869dc6092c329c46c1bc79ce30200167e481db4c1a1925005c21d6072596d5a3e5
7
- data.tar.gz: be1d98fa2a3fab4ef8e19cee15d179a4a937a8108bfe5f789a6406aa9e2c9652bd754e256eb25ecbbb59dea79d40585a3d29351d505e335a65eb14d04e2d6c2a
6
+ metadata.gz: 3facc112e5940a263ee4ab013061c89302629e181db8d077e55d5e9307fc4cb00d5e11c394e0ced52d7de987b8bc92026ab0ee04731386e52ee41b622e79f306
7
+ data.tar.gz: e4c8ffd32b2befab7ea1aa7a0387f82c71a0063c32c538ace19f701957914abc10e792a685957137f35eaea5dc117e010c54b088356f14c9a62e76fc91064bef
data/README.md CHANGED
@@ -14,13 +14,14 @@
14
14
 
15
15
  ---
16
16
 
17
- Spyke basically ~~rips off~~ takes inspiration :innocent: from [Her](https://github.com/remiprev/her), a gem which we sadly had to abandon as it gave us some performance problems and maintenance seemed to had gone stale.
17
+ Spyke basically ~~rips off~~ takes inspiration :innocent: from [Her](https://github.com/remiprev/her), a gem which we sadly had to abandon as it gave us some performance problems and maintenance seemed to have gone stale.
18
18
 
19
- We therefore made Spyke which adds a few fixes/features that we needed for our projects:
19
+ We therefore made Spyke which adds a few fixes/features needed for our projects:
20
20
 
21
21
  - Fast handling of even large amounts of JSON
22
22
  - Proper support for scopes
23
23
  - Ability to define custom URIs for associations
24
+ - ActiveRecord-like log output
24
25
  - Googlable name! :)
25
26
 
26
27
  ## Configuration
@@ -104,10 +105,10 @@ You can specify custom URIs on both the class and association level:
104
105
 
105
106
  ```ruby
106
107
  class User < Spyke::Base
107
- uri '/v1/users/(:id)' # id optional, both /v1/users and /v1/users/4 are usable
108
+ uri '/v1/users/(:id)' # id optional, both /v1/users and /v1/users/4 are valid
108
109
 
109
- has_one :image, uri: nil
110
110
  has_many :posts, uri: '/posts/for_user/:user_id' # user_id is required
111
+ has_one :image, uri: nil # only use embedded JSON
111
112
  end
112
113
 
113
114
  class Post < Spyke::Base
@@ -134,5 +135,5 @@ Completed 200 OK in 75ms (Views: 64.6ms | Spyke: 40.3ms | ActiveRecord: 0ms)
134
135
 
135
136
  ## Contributing
136
137
 
137
- If possible please take a look at the tests marked "wishlisted"!
138
+ If possible please take a look at the [tests marked "wishlisted"](https://github.com/balvig/spyke/search?utf8=%E2%9C%93&q=wishlisted)!
138
139
  These are features/fixes we want to implement but haven't gotten around to doing yet :)
data/lib/spyke/path.rb CHANGED
@@ -43,7 +43,13 @@ module Spyke
43
43
  end
44
44
 
45
45
  def missing_required_params
46
- required_params - @params.keys
46
+ required_params - params_with_values
47
+ end
48
+
49
+ def params_with_values
50
+ @params.map do |key, value|
51
+ key if value.present?
52
+ end.compact
47
53
  end
48
54
 
49
55
  def required_params
data/lib/spyke/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Spyke
2
- VERSION = '1.7.0'
2
+ VERSION = '1.7.1'
3
3
  end
@@ -124,5 +124,11 @@ module Spyke
124
124
  assert_requested tip_endpoint
125
125
  assert_requested likes_endpoint
126
126
  end
127
+
128
+ def test_path_validation
129
+ assert_raises Spyke::InvalidPathError do
130
+ Recipe.new.groups.to_a
131
+ end
132
+ end
127
133
  end
128
134
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: spyke
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.7.0
4
+ version: 1.7.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jens Balvig