quintype-api 0.1.3 → 0.1.5

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 33d8f416309a11bd511f6d8e97fbca7fecc9ac57
4
- data.tar.gz: 1386af307d5441ac4867206cf74989ca857a1f0a
3
+ metadata.gz: 2cdec505057a5120c7972e539755dbb42a659a32
4
+ data.tar.gz: 0a2fecac1f6157ae317dedab2ecce89bad30b2a4
5
5
  SHA512:
6
- metadata.gz: a924dfb0b0befb27c1459d26a357afc3e1466465d5beae6307c7ac4f07e85a0976cd0fb64ac2f1872a9664ef17a8230337dc410cbcd9a438dbe68c975d94346b
7
- data.tar.gz: 64644f757db104a16fecb780459bea472825bdae3caa708827659e995ad03fdb2dd3fc6ad81cc7295cd93ab0b79659c9a2d79333400952ada704d319c17783eb
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 {|i| i.to_s.gsub(/_/, "-")}
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
@@ -1,5 +1,5 @@
1
1
  module Quintype::API
2
- class Config < Base(:sketches_host, :sections, :layout, :cdn_name, :publisher_id, :story_slug_format, :cdn_image)
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(:id, :item_id, :rank, :title, :item_type, :tag_name, :section_slug, :parent_id, :data)
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
@@ -1,4 +1,4 @@
1
1
  module Quintype::API
2
- class Section < Base(:id, :name, :display_name, :slug, :parent_id)
2
+ class Section < Base(%w(id name display-name slug parent-id))
3
3
  end
4
4
  end
@@ -1,4 +1,4 @@
1
1
  module Quintype::API
2
- class Stack < Base(:show_on_locations, :background_color, :rank, :story_group, :max_stories, :id, :show_on_all_sections?, :heading)
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
@@ -27,7 +27,7 @@ module Quintype::API
27
27
  end
28
28
  end
29
29
 
30
- class SearchResults < Base(:from, :size, :total, :stories)
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(: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)
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)
@@ -1,5 +1,5 @@
1
1
  module Quintype
2
2
  module Api
3
- VERSION = "0.1.3"
3
+ VERSION = "0.1.5"
4
4
  end
5
5
  end
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(*args)
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.3
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-16 00:00:00.000000000 Z
11
+ date: 2016-06-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday