actv 1.3.8 → 1.3.9

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 34fd1ff335543d92ce4b8bdb9bd96939eceba9b6
4
- data.tar.gz: fddaca63f6700ff5811ece0119b4c19b38895aa5
3
+ metadata.gz: 574f192d113e5554c774a66fbd23b7db4b3c5743
4
+ data.tar.gz: f2baf37eaf431bce2ddd08a3998baa38e6e4db0f
5
5
  SHA512:
6
- metadata.gz: f68f86eedc922a7df45b7c3c49a40c72a003841b810a2c09c8130747478d6155a4e34344249ec0921f9567f17a12513e15c80a5db59d8568c4632d5d987161ec
7
- data.tar.gz: 161b210931780a12abe122c8170d6c82b9feae19c915f1f9b1aceb04176351680fa186c2b4edb0614b363eff7576e77c0d886490bf767a0377c097d4686225d8
6
+ metadata.gz: 9b5654c5cf79b41afcf5d1ff755feaec72ae33e9c68508d57c270ee9632af91c3d6a23daeba2fc83808d0e575cf88291d1795121ab6561ab0bfa23b80efd18a0
7
+ data.tar.gz: 231bb9d7f931c74baa5abe1b696bf0efd42351ee9db49976a63080f7c0d6acba72dadf099a53cd73ebccef529ba13efb7c5e626c25acbc46bab9ced45572d05f
@@ -152,9 +152,14 @@ module ACTV
152
152
  # @param options [Hash] A customizable set of options.
153
153
  # @example Return the article with the id BA288960-2718-4B20-B380-8F939596B123
154
154
  # ACTV.article("BA288960-2718-4B20-B380-8F939596B123")
155
- def article(id)
156
- response = get("/v2/assets/#{id}.json")
157
- article = ACTV::Article.from_response(response)
155
+ def article id, params={}
156
+ request_string = "/v2/assets/#{id}"
157
+ is_preview, params = params_include_preview? params
158
+ request_string = '/preview' if is_preview
159
+
160
+ response = get "#{request_string}.json", params
161
+
162
+ article = ACTV::Article.from_response response
158
163
  article.is_article? ? article : nil
159
164
  end
160
165
 
@@ -1,3 +1,3 @@
1
1
  module ACTV
2
- VERSION = "1.3.8"
2
+ VERSION = "1.3.9"
3
3
  end
@@ -157,6 +157,50 @@ describe ACTV::Client do
157
157
  end
158
158
  end
159
159
 
160
+ describe '#article' do
161
+ let(:configuration) do
162
+ { consumer_key: "CK",
163
+ consumer_secret: "CS",
164
+ oauth_token: "OT",
165
+ oauth_token_secret: "OS"}
166
+ end
167
+
168
+ context 'find event' do
169
+ before do
170
+ stub_request(:get, "http://api.amp.active.com/v2/assets/asset_id.json").
171
+ to_return(body: fixture("valid_article.json"), headers: { content_type: "application/json; charset=utf-8" })
172
+ end
173
+
174
+ it 'makes a normal asset call' do
175
+ expect(client.article 'asset_id').to be_an ACTV::Article
176
+ end
177
+ end
178
+
179
+ context 'preview event' do
180
+ context 'when preview is true' do
181
+ before do
182
+ stub_request(:get, "http://api.amp.active.com/preview.json").
183
+ to_return(body: fixture("valid_article.json"), headers: { content_type: "application/json; charset=utf-8" })
184
+ end
185
+
186
+ it 'returns an event' do
187
+ expect(client.article 'asset_id', preview: 'true').to be_an ACTV::Article
188
+ end
189
+ end
190
+
191
+ context 'when preview is false' do
192
+ before do
193
+ stub_request(:get, "http://api.amp.active.com/v2/assets/asset_id.json").
194
+ to_return(body: fixture("valid_article.json"), headers: { content_type: "application/json; charset=utf-8" })
195
+ end
196
+
197
+ it 'returns an event' do
198
+ expect(client.article 'asset_id', preview: 'false').to be_an ACTV::Article
199
+ end
200
+ end
201
+ end
202
+ end
203
+
160
204
  describe '#event' do
161
205
  let(:configuration) do
162
206
  { consumer_key: "CK",
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: actv
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.8
4
+ version: 1.3.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nathaniel Barnes
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-03-13 00:00:00.000000000 Z
11
+ date: 2015-05-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday