spyke 1.7.0 → 1.7.1
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/README.md +6 -5
- data/lib/spyke/path.rb +7 -1
- data/lib/spyke/version.rb +1 -1
- data/test/relation_test.rb +6 -0
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e6613906c7dbb4e350d7d7bbe598b0775b8283ec
|
4
|
+
data.tar.gz: c1532061ab3a9fb149ffcdd23edf6212e489b1cc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
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
|
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
|
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 -
|
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
data/test/relation_test.rb
CHANGED