boxspring 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: a1c2d63de3bbf876dac40c3be09ae19177485167
4
- data.tar.gz: 88abf8b65ed7404ffcd554c0f800dcebe72b44c4
3
+ metadata.gz: 09830de236195049509da43c4dd2173ba7c1c97b
4
+ data.tar.gz: 3da588b61fa9c478c60d14f57d159b18e1483b20
5
5
  SHA512:
6
- metadata.gz: 63da301167de7d28e04928183b3846f6f448092b61cc207a17e85b6357bddfacac6a440ad57b53cc7247d6814a10d0ffb0bb4f6e000dcf4ece698ec6e5ab5b98
7
- data.tar.gz: a116282c2a6cf757653ea3ac3bc522cc50ef49de74a731627470fb9813d79d30615616d6e9f62971275f516eeffe9a0f03c6cddc64c7f55dfff268f084ed1287
6
+ metadata.gz: 6b59f02a88834f4baedcdf9b54781addb4594c894690800912d2dd0fc06a9311c0acec4f7c51daa8a9d96978452fbae5c2e5765c0c933a00cd532bd38874e10b
7
+ data.tar.gz: c1b529572ffd823b3c9af17f439d6a5e32972247373ecb9884170c585eaa4ae3e5a0c0cbbcb1b173af42fe4c04db597f766b0d66c7a581353152a6dbc7a5a67a
@@ -15,6 +15,7 @@ require 'boxspring/attribution'
15
15
  require 'boxspring/reaction'
16
16
  require 'boxspring/sponsor'
17
17
  require 'boxspring/service'
18
+ require 'boxspring/page'
18
19
  require 'boxspring/show'
19
20
  require 'boxspring/tag_collection'
20
21
  require 'boxspring/user_agent'
@@ -0,0 +1,18 @@
1
+ module Boxspring
2
+
3
+ class Page < Base
4
+
5
+ field :created_at
6
+ field :updated_at
7
+
8
+ field :id
9
+ field :code_name
10
+ field :name
11
+ field :body
12
+ field :slug
13
+ field :meta_description
14
+ field :meta_title
15
+
16
+ end
17
+
18
+ end
@@ -21,7 +21,7 @@ module Boxspring
21
21
  request = Request.new( parameters )
22
22
  response = request.get( '/configuration' )
23
23
 
24
- # did the api request succeed
24
+ # did the api request succeed
25
25
  if ( response.success? )
26
26
  # construct a property; assign it the api interface
27
27
  Property.new( response.content ).tap do | property |
@@ -72,6 +72,31 @@ module Boxspring
72
72
  self.services.detect { |service| service.provider == provider }
73
73
  end
74
74
 
75
+ def pages( parameters = {} )
76
+ @pages ||= begin
77
+ self.attributes.include?( :pages ) ?
78
+ self.attributes[ :pages ].map do | page |
79
+ Page.new( page )
80
+ end :
81
+ nil
82
+ end
83
+ end
84
+
85
+ def page_by_code_name( code_name )
86
+ self.pages.detect { |page| page.code_name == code_name }
87
+ end
88
+
89
+ def page_by_id( id )
90
+ response = @api_interface.get( "/pages/#{id}" )
91
+ if ( response.success? )
92
+ Page.new( response.content )
93
+ elsif ( response.code == '404' )
94
+ nil
95
+ else
96
+ raise response.error
97
+ end
98
+ end
99
+
75
100
  def tag_collections( reload = false )
76
101
  @_tag_collections ||= begin
77
102
  self.attributes.include?( :tag_collections ) ?
@@ -162,8 +187,8 @@ module Boxspring
162
187
  end
163
188
  end
164
189
 
165
- def story_by_id( id )
166
- response = @api_interface.get( "/stories/#{id}" )
190
+ def story_by_id( id, parameters = {} )
191
+ response = @api_interface.get( "/stories/#{id}", parameters )
167
192
  if ( response.success? )
168
193
  Story.new( response.content )
169
194
  elsif ( response.code == '404' )
@@ -19,7 +19,7 @@ module Boxspring
19
19
 
20
20
  @success =
21
21
  http_response.is_a?( Net::HTTPOK ) &&
22
- ( !@content.nil? ) &&
22
+ @content.present? &&
23
23
  @error.nil?
24
24
 
25
25
  @error = Boxspring::Error.new( 'unknown' ) \
@@ -1,3 +1,3 @@
1
1
  module Boxspring
2
- VERSION = '0.1.3'
3
- end
2
+ VERSION = '0.1.5'
3
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: boxspring
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
  - Kristoph Cichocki-Romanov
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-05-30 00:00:00.000000000 Z
11
+ date: 2014-06-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: addressable
@@ -80,6 +80,7 @@ files:
80
80
  - lib/boxspring/card.rb
81
81
  - lib/boxspring/configuration.rb
82
82
  - lib/boxspring/error.rb
83
+ - lib/boxspring/page.rb
83
84
  - lib/boxspring/picture.rb
84
85
  - lib/boxspring/pictureable.rb
85
86
  - lib/boxspring/property.rb