quintype-api 0.1.3 → 0.1.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/quintype/api/base_functions.rb +5 -1
- data/lib/quintype/api/config.rb +1 -1
- data/lib/quintype/api/menu_item.rb +1 -1
- data/lib/quintype/api/section.rb +1 -1
- data/lib/quintype/api/stack.rb +1 -1
- data/lib/quintype/api/story.rb +2 -3
- data/lib/quintype/api/version.rb +1 -1
- data/lib/quintype/api.rb +5 -3
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2cdec505057a5120c7972e539755dbb42a659a32
|
4
|
+
data.tar.gz: 0a2fecac1f6157ae317dedab2ecce89bad30b2a4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1877becec4255269134a6791e1e6b4cb726878278f1e253feb6930fc8077b79aebd42a0310827aa97713c72295953331014af3ada8372e66939d2bee42b85021
|
7
|
+
data.tar.gz: a7a43cd5b55f3a63b16dcce7c94a95d3a41f356d9203854ce5894df1f64aa0f3f7a556a2d899ce0dad20394ad129270e5a85cc14b3b49331f67791b482034c7f
|
@@ -2,7 +2,7 @@ module Quintype::API
|
|
2
2
|
module BaseFunctions
|
3
3
|
module ClassFunctions
|
4
4
|
def members_as_string
|
5
|
-
@members_as_string ||= members.map
|
5
|
+
@members_as_string ||= members.map(&:to_s)
|
6
6
|
end
|
7
7
|
|
8
8
|
def from_hash(hash, *args)
|
@@ -28,6 +28,10 @@ module Quintype::API
|
|
28
28
|
|
29
29
|
def self.included(clazz)
|
30
30
|
clazz.extend(ClassFunctions)
|
31
|
+
clazz.members_as_string.each do |hypenated_key|
|
32
|
+
underscore_key = hypenated_key.gsub(/-/, '_')
|
33
|
+
clazz.send(:alias_method, underscore_key, hypenated_key) if underscore_key != hypenated_key
|
34
|
+
end
|
31
35
|
end
|
32
36
|
end
|
33
37
|
end
|
data/lib/quintype/api/config.rb
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
module Quintype::API
|
2
|
-
class Config < Base(
|
2
|
+
class Config < Base(%w(sketches-host sections layout cdn-name publisher-id story-slug-format cdn-image))
|
3
3
|
class << self
|
4
4
|
def get
|
5
5
|
from_hash(Client.instance.get_config)
|
@@ -1,5 +1,5 @@
|
|
1
1
|
module Quintype::API
|
2
|
-
class MenuItem < Base(
|
2
|
+
class MenuItem < Base(%w(id item-id rank title item-type tag-name section-slug parent-id data))
|
3
3
|
|
4
4
|
def initialize(config, *args)
|
5
5
|
@config = config
|
data/lib/quintype/api/section.rb
CHANGED
data/lib/quintype/api/stack.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
1
|
module Quintype::API
|
2
|
-
class Stack < Base(
|
2
|
+
class Stack < Base(%w(show-on-locations background-color rank story-group max-stories id show-on-all-sections? heading))
|
3
3
|
end
|
4
4
|
end
|
data/lib/quintype/api/story.rb
CHANGED
@@ -27,7 +27,7 @@ module Quintype::API
|
|
27
27
|
end
|
28
28
|
end
|
29
29
|
|
30
|
-
class SearchResults < Base(
|
30
|
+
class SearchResults < Base(%w(from size total stories))
|
31
31
|
include Enumerable
|
32
32
|
|
33
33
|
def each
|
@@ -51,8 +51,7 @@ module Quintype::API
|
|
51
51
|
end
|
52
52
|
end
|
53
53
|
|
54
|
-
class Story < Base(
|
55
|
-
|
54
|
+
class Story < Base(%w(updated-at assignee-id author-name tags headline storyline-id votes story-content-id slug last-published-at sections content-created-at owner-name custom-slug push-notification publisher-id hero-image-metadata comments published-at storyline-title summary autotags status bullet-type id hero-image-s3-key cards story-version-id content-updated-at author-id owner-id first-published-at hero-image-caption version story-template created-at authors metadata publish-at assignee-name))
|
56
55
|
class << self
|
57
56
|
def find_by_slug(slug)
|
58
57
|
response = Client.instance.get_story_by_slug(slug)
|
data/lib/quintype/api/version.rb
CHANGED
data/lib/quintype/api.rb
CHANGED
@@ -8,8 +8,8 @@ module Quintype
|
|
8
8
|
autoload :Client, "quintype/api/client"
|
9
9
|
autoload :BaseFunctions, "quintype/api/base_functions"
|
10
10
|
|
11
|
-
def self.Base(
|
12
|
-
clazz = Struct.new(*args)
|
11
|
+
def self.Base(args)
|
12
|
+
clazz = Struct.new(*args.map(&:intern))
|
13
13
|
clazz.send(:include, BaseFunctions)
|
14
14
|
clazz
|
15
15
|
end
|
@@ -18,8 +18,10 @@ module Quintype
|
|
18
18
|
autoload :Section, "quintype/api/section"
|
19
19
|
autoload :MenuItem, "quintype/api/menu_item"
|
20
20
|
autoload :Stack, "quintype/api/stack"
|
21
|
-
autoload :StackCollection, "quintype/api/stack_collection"
|
22
21
|
autoload :Story, "quintype/api/story"
|
22
|
+
|
23
|
+
autoload :StackCollection, "quintype/api/stack_collection"
|
24
|
+
|
23
25
|
autoload :Bulk, "quintype/api/bulk"
|
24
26
|
end
|
25
27
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: quintype-api
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tejas Dinkar
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-06-
|
11
|
+
date: 2016-06-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faraday
|