impact_radius_api 0.1.3 → 0.2.0
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 +4 -4
- data/README.md +19 -1
- data/lib/impact_radius_api/mediapartners.rb +3 -1
- data/lib/impact_radius_api/version.rb +1 -1
- data/spec/impact_radius_api_spec.rb +15 -9
- 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: 4705bc56b49e2828bb304b29cade753fafd8ccae
|
4
|
+
data.tar.gz: f8c14af974e83fab6addb25455d94a918432ed79
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fd001e5bfbb271d5ae2ba814aa1ce7ea3b087075979750e5fa9555a5da6b7ae75c6070f7ccf9204e5baf5164464ef422be8eb218c243ef4a1e8b10471cff4529
|
7
|
+
data.tar.gz: 5f98b3b804628b8bab9e258f87cd4597a09bd8fcce0a28a4ca749f5759591d367f112eceffbede7a0850184bc71851d1de3747a3147fc3125e5ec44d0a13d7e2
|
data/README.md
CHANGED
@@ -74,13 +74,31 @@ mediapartners = ImpactRadiusAPI::Mediapartners.new
|
|
74
74
|
options = {
|
75
75
|
Query=Color:"Red"
|
76
76
|
}
|
77
|
-
response = mediapartners.get("
|
77
|
+
response = mediapartners.get("Catalogs/ItemSearch", options)
|
78
78
|
response.data.each do |item|
|
79
79
|
puts "Name: #{item.Name}"
|
80
80
|
puts "Description: #{item.Description}"
|
81
81
|
puts "Link: #{item.TrackingLink}"
|
82
82
|
end
|
83
83
|
```
|
84
|
+
###Media Partner List Catalog Items
|
85
|
+
Retrieves a list of specific catalog items using the catalog number.
|
86
|
+
```ruby
|
87
|
+
require "impact_radius_api" #not needed for RoR
|
88
|
+
ImpactRadiusAPI.auth_token = ENV["IR_AUTH_TOKEN"] #can be in app/config/initializer/impact_radius_api.rb of RoR
|
89
|
+
ImpactRadiusAPI.account_sid = ENV["IR_ACCOUNT_SID"] #can be in app/config/initializer/impact_radius_api.rb of RoR
|
90
|
+
mediapartners = ImpactRadiusAPI::Mediapartners.new
|
91
|
+
options = {
|
92
|
+
Query=Color:"Red"
|
93
|
+
}
|
94
|
+
response = mediapartners.get("Catalogs/{CatalogID}/Items", options)
|
95
|
+
response.data.each do |item|
|
96
|
+
puts "Name: #{item.Name}"
|
97
|
+
puts "Description: #{item.Description}"
|
98
|
+
puts "Link: #{item.TrackingLink}"
|
99
|
+
end
|
100
|
+
```
|
101
|
+
CatalogId Intger required Id for specific Catalog. Example 2255
|
84
102
|
|
85
103
|
If there are multiple pages, retrieve all the pages by using the ```all``` method:
|
86
104
|
```ruby
|
@@ -18,7 +18,9 @@ module ImpactRadiusAPI
|
|
18
18
|
when "Items"
|
19
19
|
"Items"
|
20
20
|
when "Catalogs/ItemSearch"
|
21
|
-
"Items"
|
21
|
+
"Items"
|
22
|
+
when /Catalogs\/\d{4}\/Items/
|
23
|
+
"Items"
|
22
24
|
else
|
23
25
|
raise InvalidRequestError.new("#{resource} is not a valid Media Partner Resources. Refer to: http://dev.impactradius.com/display/api/Media+Partner+Resources for valid Media Partner Resources.")
|
24
26
|
end
|
@@ -31,7 +31,7 @@ describe "impact_radius_api" do
|
|
31
31
|
end
|
32
32
|
end
|
33
33
|
|
34
|
-
describe".base_path" do
|
34
|
+
describe".base_path" do
|
35
35
|
it "should return error if APIResource" do
|
36
36
|
resource = ImpactRadiusAPI::APIResource.new
|
37
37
|
expect{resource.base_path}.to raise_error(ImpactRadiusAPI::NotImplementedError)
|
@@ -239,8 +239,8 @@ describe "impact_radius_api" do
|
|
239
239
|
XML
|
240
240
|
stub_request(
|
241
241
|
:get,
|
242
|
-
"https://api.impactradius.com/Mediapartners/IRkXujcbpSTF35691nPwrFCQsbVBwamUD1/Ads?
|
243
|
-
).
|
242
|
+
"https://IRkXujcbpSTF35691nPwrFCQsbVBwamUD1:CEdwLRxstFyC2qLAi58MiYe6sqVKD7Dm@api.impactradius.com/Mediapartners/IRkXujcbpSTF35691nPwrFCQsbVBwamUD1/Ads?Page=2&PageSize=2").
|
243
|
+
with(:headers => {'Accept'=>'*/*', 'Accept-Encoding'=>'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'User-Agent'=>'Ruby'}).
|
244
244
|
to_return(
|
245
245
|
status: 200,
|
246
246
|
body: xml_response2,
|
@@ -263,8 +263,8 @@ describe "impact_radius_api" do
|
|
263
263
|
XML
|
264
264
|
stub_request(
|
265
265
|
:get,
|
266
|
-
"https://api.impactradius.com/Mediapartners/IRkXujcbpSTF35691nPwrFCQsbVBwamUD1/Ads?PageSize=2
|
267
|
-
).
|
266
|
+
"https://IRkXujcbpSTF35691nPwrFCQsbVBwamUD1:CEdwLRxstFyC2qLAi58MiYe6sqVKD7Dm@api.impactradius.com/Mediapartners/IRkXujcbpSTF35691nPwrFCQsbVBwamUD1/Ads?Page=3&PageSize=2").
|
267
|
+
with(:headers => {'Accept'=>'*/*', 'Accept-Encoding'=>'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'User-Agent'=>'Ruby'}).
|
268
268
|
to_return(
|
269
269
|
status: 200,
|
270
270
|
body: xml_response3,
|
@@ -346,8 +346,8 @@ describe "impact_radius_api" do
|
|
346
346
|
XML
|
347
347
|
stub_request(
|
348
348
|
:get,
|
349
|
-
|
350
|
-
).
|
349
|
+
"https://IRkXujcbpSTF35691nPwrFCQsbVBwamUD1:CEdwLRxstFyC2qLAi58MiYe6sqVKD7Dm@api.impactradius.com/Mediapartners/IRkXujcbpSTF35691nPwrFCQsbVBwamUD1/PromoAds?Page=2&PageSize=2").
|
350
|
+
with(:headers => {'Accept'=>'*/*', 'Accept-Encoding'=>'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'User-Agent'=>'Ruby'}).
|
351
351
|
to_return(
|
352
352
|
status: 200,
|
353
353
|
body: xml_response2,
|
@@ -379,8 +379,8 @@ describe "impact_radius_api" do
|
|
379
379
|
XML
|
380
380
|
stub_request(
|
381
381
|
:get,
|
382
|
-
|
383
|
-
).
|
382
|
+
"https://IRkXujcbpSTF35691nPwrFCQsbVBwamUD1:CEdwLRxstFyC2qLAi58MiYe6sqVKD7Dm@api.impactradius.com/Mediapartners/IRkXujcbpSTF35691nPwrFCQsbVBwamUD1/PromoAds?Page=3&PageSize=2").
|
383
|
+
with(:headers => {'Accept'=>'*/*', 'Accept-Encoding'=>'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'User-Agent'=>'Ruby'}).
|
384
384
|
to_return(
|
385
385
|
status: 200,
|
386
386
|
body: xml_response3,
|
@@ -829,6 +829,12 @@ describe "impact_radius_api" do
|
|
829
829
|
expect(mediapartners.xml_field("Catalogs/ItemSearch")).to eq("Items")
|
830
830
|
end
|
831
831
|
end
|
832
|
+
context "Items for list catalog items" do
|
833
|
+
it "returns Items for List Catalogs Items" do
|
834
|
+
mediapartners = ImpactRadiusAPI::Mediapartners.new
|
835
|
+
expect(mediapartners.xml_field("Catalogs/4525/Items")).to eq("Items")
|
836
|
+
end
|
837
|
+
end
|
832
838
|
end
|
833
839
|
end
|
834
840
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: impact_radius_api
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Kirk Jarvis
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-11-
|
11
|
+
date: 2017-11-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|