quintype-api 0.2.0 → 0.2.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 +13 -1
- data/lib/quintype/api/author.rb +9 -0
- data/lib/quintype/api/bulk.rb +4 -0
- data/lib/quintype/api/client.rb +6 -0
- data/lib/quintype/api/version.rb +1 -1
- data/lib/quintype/api.rb +1 -0
- metadata +2 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 10c1012bf469aef0d78783d302b9b970804e5cd8
|
4
|
+
data.tar.gz: 8dfaeefdc8b52436457fbb069bce38ccd88844bd
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1d682835eec47a0e0176f1a4a0f5fd314dad7873c300848139a0b6191f534e8c97d26ab3f63a08f705c4ccb465fdd0a4aea80b17d5354be1d89ccf1d4ccf7edb
|
7
|
+
data.tar.gz: 43134e059e881c2b5f3fb720d1600d60e58efac34b2f483761b095a8ecdb98e21c0ba7b5f4c4272dcd4fecdaf450076bd92c9efe4c3662e1ba4fc2e367e2e2ae
|
data/README.md
CHANGED
@@ -32,13 +32,25 @@ Quintype::API::Client.establish_connection("http://sketches.quintype.com", Farad
|
|
32
32
|
|
33
33
|
### Subclassing API classes
|
34
34
|
|
35
|
-
It is highly recommended that you subclass API sections. This is mostly honored during requests
|
35
|
+
It is highly recommended that you subclass API sections. This is mostly honored during requests. If you use liquid, implement a to_liquid method.
|
36
36
|
|
37
37
|
```ruby
|
38
38
|
class QtConfig < Quintype::API::Config
|
39
|
+
def to_liquid
|
40
|
+
ActiveSupport::HashWithIndifferentAccess.new to_h
|
41
|
+
end
|
39
42
|
end
|
40
43
|
|
41
44
|
class Story < Quintype::API::Story
|
45
|
+
def to_liquid
|
46
|
+
ActiveSupport::HashWithIndifferentAccess.new to_h
|
47
|
+
end
|
48
|
+
end
|
49
|
+
|
50
|
+
class Author < Quintype::API::Author
|
51
|
+
def to_liquid
|
52
|
+
ActiveSupport::HashWithIndifferentAccess.new to_h
|
53
|
+
end
|
42
54
|
end
|
43
55
|
```
|
44
56
|
|
data/lib/quintype/api/bulk.rb
CHANGED
data/lib/quintype/api/client.rb
CHANGED
@@ -60,6 +60,12 @@ module Quintype::API
|
|
60
60
|
response.body["results"]
|
61
61
|
end
|
62
62
|
|
63
|
+
def get_author(author_id)
|
64
|
+
response = get("/api/v1/authors/#{author_id}")
|
65
|
+
raise ClientException.new("Could not get authors", response) unless response.status == 200
|
66
|
+
response.body["author"]
|
67
|
+
end
|
68
|
+
|
63
69
|
def post_bulk(requests)
|
64
70
|
response = post("/api/v1/bulk", requests: requests)
|
65
71
|
raise ClientException.new("Could not bulk fetch", response) unless response.status == 200
|
data/lib/quintype/api/version.rb
CHANGED
data/lib/quintype/api.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: quintype-api
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tejas Dinkar
|
@@ -81,6 +81,7 @@ files:
|
|
81
81
|
- bin/console
|
82
82
|
- bin/setup
|
83
83
|
- lib/quintype/api.rb
|
84
|
+
- lib/quintype/api/author.rb
|
84
85
|
- lib/quintype/api/base_functions.rb
|
85
86
|
- lib/quintype/api/bulk.rb
|
86
87
|
- lib/quintype/api/client.rb
|