outbrain-api 0.1.2 → 0.1.3

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: ec9b938dc9b56095543cd905fcee2c9f8b5099ac
4
- data.tar.gz: 9f783ad70d59228dc8f99f9a503d895bb0922864
3
+ metadata.gz: 9dea9a236f8bbc8f787377154343c7759666859c
4
+ data.tar.gz: 402fa007f82eb8e5402db3acdbd8bdd4dc6479d1
5
5
  SHA512:
6
- metadata.gz: a63c9947ba7ce26dd5efa7aeee84a97896177c46a477543999d3ae24bad21aae090b718a87f90da4c01d54aa48218f9a9d8cfd832a0dfa448fefe4ef3dc0e9a7
7
- data.tar.gz: 84ad7a25031f21daf555e436784c65b254341fb2757d938bd04a1f818bf38bc82e6a7360d6aa22cfbc9544870202ec9640860cd5f6fe87dd45dfd5397c57573e
6
+ metadata.gz: b57148a05ccf124f55f5253d88cfa23e90150ba82fbf2ee7beaf1ec011e09a5c620e11e5bb3acc55e5c33368ee10bceebe52a86ac34b8d1c4f61bff5f6eb6ebd
7
+ data.tar.gz: 2c9e02db5a33a39c63b624bb3986dbb9102b678353b81a4666359445a44de1a40302db232d69779bb8acbba7004918200311c0c30f08b031a9c290c445586bd5
@@ -6,6 +6,10 @@ module Outbrain
6
6
  def self.create(attributes)
7
7
  Request.create(PATH, { as: self, attributes: attributes })
8
8
  end
9
+
10
+ def self.find(campaign_id)
11
+ Request.find(PATH, campaign_id, { as: self })
12
+ end
9
13
  end
10
14
  end
11
- end
15
+ end
@@ -1,5 +1,5 @@
1
1
  module Outbrain
2
2
  module Api
3
- VERSION = "0.1.2"
3
+ VERSION = "0.1.3"
4
4
  end
5
5
  end
@@ -17,6 +17,21 @@ module Outbrain
17
17
  where(resource, {}, options)
18
18
  end
19
19
 
20
+ def self.find(resource_path, id, options={})
21
+ response = api.get("/amplify/#{api_version}/#{resource_path}/#{id}")
22
+ json_body = JSON.parse(response.body)
23
+
24
+ fail InvalidOption 'requires an as option' unless options[:as]
25
+
26
+ if response.status == 200
27
+ options[:as].new(json_body)
28
+ else
29
+ a = options[:as].new
30
+ a.errors.push(json_body)
31
+ a
32
+ end
33
+ end
34
+
20
35
  def self.create(resource, options={})
21
36
  attributes = options.fetch(:attributes, {})
22
37
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: outbrain-api
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nick Blanchet
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2016-03-07 00:00:00.000000000 Z
11
+ date: 2016-03-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday