rocketfuel_api 0.1.1 → 0.1.2

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: 6c1934476e53d7e1a2de61694d668a3320bf57cf
4
- data.tar.gz: dd323501ad5834ba4106cbd3a9df6dacce9bbd2d
3
+ metadata.gz: 2356648db6cb773e93d12bf0c4b0a576fc17d3da
4
+ data.tar.gz: 8ea8ffd2797fd0ba516604eca4a9862288320b44
5
5
  SHA512:
6
- metadata.gz: 3564620fcca9fa5745f735acb526bf640d815e6152189e34f47ae19ce2b0ad171ab8092918a1a463c74b0670ce83e87c69cdd4bf31fa04ca16e61a90b310b6e1
7
- data.tar.gz: cee4576ed7f0f4429d8e3d997762e83a2e74602503d16c577f307cf825c9ee75f92ae152dfbb5151dd0b01f8aec9395ea04b63241cd64f91b7f5a81d73eaf4d6
6
+ metadata.gz: 825a043e75a174a884e46d7098f4ff3a2e97edd6a511c41729a95b19e316ef84f3c2a1581a62c7495edd0b435244c1b72e4a8a26559aa5360e5d9af358e12f69
7
+ data.tar.gz: 204a02272d3714d633a9174951fe28c771dc4b776eee5de321b827f094c64948f08d2e222f9c61f67be8172dd813b95f44d2fbe22988a31e5a756ec6cb4cf754
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # RocketfuelApi [![CircleCI](https://circleci.com/gh/ad2games/rocketfuel_api.svg?style=svg)](https://circleci.com/gh/ad2games/rocketfuel_api)
2
2
 
3
- Client library for [Rocketfuel API](https://api.rocketfuel.com)
3
+ Unofficial client library for [Rocketfuel API](https://api.rocketfuel.com)
4
4
 
5
5
  ## Installation
6
6
 
@@ -0,0 +1,17 @@
1
+ service:
2
+ advertisement_ad_assignment: 'ads/ad_assignments'
3
+ advertisement_card: 'ads/cards'
4
+ assigned_flight: 'assigned_flights'
5
+ campaign_pixel: 'campaigns/pixels'
6
+ campaign: 'campaigns'
7
+ company: 'companies'
8
+ flight: 'flights'
9
+ line_item: 'line_items'
10
+ pixel_search: 'pixels/search'
11
+ pixel: 'pixels'
12
+ reporting_dimension: 'reports/dimensions'
13
+ reporting_metric: 'reports/metrics'
14
+ reporting: 'reports'
15
+ sub_network: 'sub_networks'
16
+ tactic: 'tactics'
17
+ thrid_party_pixel_search: 'thrid_party_pixels/search'
@@ -19,12 +19,13 @@ class RocketfuelApi::Service
19
19
  end
20
20
  end
21
21
 
22
- def plural_name
23
- name + 's'
24
- end
25
-
26
22
  def uri_suffix
27
- plural_name
23
+ file_path = RocketfuelApi.root.join('lib', 'config', 'endpoints_for_services.yaml')
24
+ endpoints = YAML.load_file(file_path)
25
+ endpoint = endpoints['service'][name]
26
+
27
+ endpoint || raise(RocketfuelApi::NotImplemented,
28
+ format('No endpoint for service %s available.', name))
28
29
  end
29
30
 
30
31
  def get(id, params = {})
@@ -42,8 +43,6 @@ class RocketfuelApi::Service
42
43
  end
43
44
 
44
45
  def create(route_params = {}, body = {})
45
- raise(RocketfuelApi::NotImplemented, 'Service is read-only.') if @read_only
46
-
47
46
  body = { uri_name => body }
48
47
  route = @connection.build_url(uri_suffix, route_params)
49
48
  response = @connection.post(route, body)
@@ -56,8 +55,6 @@ class RocketfuelApi::Service
56
55
  end
57
56
 
58
57
  def update(id, route_params = {}, body = {})
59
- raise(AppnexusApi::NotImplemented, 'Service is read-only.') if @read_only
60
-
61
58
  body = { uri_name => body }
62
59
  route = @connection.build_url(uri_suffix, route_params.merge('id' => id))
63
60
  response = @connection.put(route, body)
@@ -78,7 +75,7 @@ class RocketfuelApi::Service
78
75
  when Hash
79
76
  resource_class.new(response, self)
80
77
  else
81
- raise format("Can't parse response, it's a %s", response.class)
78
+ raise(RocketfuelApi::NotImplemented, format('Unknown response type %s.', response.class))
82
79
  end
83
80
  end
84
81
  end
@@ -2,12 +2,6 @@
2
2
 
3
3
  class RocketfuelApi::Service::AdvertisementAdAssignment < RocketfuelApi::Service
4
4
  def initialize(connection)
5
- @read_only = true
6
-
7
5
  super(connection)
8
6
  end
9
-
10
- def uri_suffix
11
- 'ads/ad_assignments'
12
- end
13
7
  end
@@ -2,12 +2,6 @@
2
2
 
3
3
  class RocketfuelApi::Service::AdvertisementCard < RocketfuelApi::Service
4
4
  def initialize(connection)
5
- @read_only = true
6
-
7
5
  super(connection)
8
6
  end
9
-
10
- def uri_suffix
11
- 'ads/cards'
12
- end
13
7
  end
@@ -2,12 +2,6 @@
2
2
 
3
3
  class RocketfuelApi::Service::AssignedFlight < RocketfuelApi::Service
4
4
  def initialize(connection)
5
- @read_only = true
6
-
7
5
  super(connection)
8
6
  end
9
-
10
- def uri_suffix
11
- 'assigned_flights'
12
- end
13
7
  end
@@ -2,12 +2,6 @@
2
2
 
3
3
  class RocketfuelApi::Service::Campaign < RocketfuelApi::Service
4
4
  def initialize(connection)
5
- @read_only = true
6
-
7
5
  super(connection)
8
6
  end
9
-
10
- def uri_suffix
11
- 'campaigns'
12
- end
13
7
  end
@@ -2,12 +2,6 @@
2
2
 
3
3
  class RocketfuelApi::Service::CampaignPixel < RocketfuelApi::Service
4
4
  def initialize(connection)
5
- @read_only = true
6
-
7
5
  super(connection)
8
6
  end
9
-
10
- def uri_suffix
11
- 'campaigns/pixels'
12
- end
13
7
  end
@@ -2,12 +2,6 @@
2
2
 
3
3
  class RocketfuelApi::Service::Company < RocketfuelApi::Service
4
4
  def initialize(connection)
5
- @read_only = true
6
-
7
5
  super(connection)
8
6
  end
9
-
10
- def uri_suffix
11
- 'companies'
12
- end
13
7
  end
@@ -2,12 +2,6 @@
2
2
 
3
3
  class RocketfuelApi::Service::Flight < RocketfuelApi::Service
4
4
  def initialize(connection)
5
- @read_only = true
6
-
7
5
  super(connection)
8
6
  end
9
-
10
- def uri_suffix
11
- 'flights'
12
- end
13
7
  end
@@ -2,12 +2,6 @@
2
2
 
3
3
  class RocketfuelApi::Service::LineItem < RocketfuelApi::Service
4
4
  def initialize(connection)
5
- @read_only = true
6
-
7
5
  super(connection)
8
6
  end
9
-
10
- def uri_suffix
11
- 'line_items'
12
- end
13
7
  end
@@ -2,12 +2,6 @@
2
2
 
3
3
  class RocketfuelApi::Service::Pixel < RocketfuelApi::Service
4
4
  def initialize(connection)
5
- @read_only = true
6
-
7
5
  super(connection)
8
6
  end
9
-
10
- def uri_suffix
11
- 'pixels'
12
- end
13
7
  end
@@ -2,12 +2,6 @@
2
2
 
3
3
  class RocketfuelApi::Service::PixelSearch < RocketfuelApi::Service
4
4
  def initialize(connection)
5
- @read_only = true
6
-
7
5
  super(connection)
8
6
  end
9
-
10
- def uri_suffix
11
- 'pixels/search'
12
- end
13
7
  end
@@ -2,12 +2,6 @@
2
2
 
3
3
  class RocketfuelApi::Service::Reporting < RocketfuelApi::Service
4
4
  def initialize(connection)
5
- @read_only = true
6
-
7
5
  super(connection)
8
6
  end
9
-
10
- def uri_suffix
11
- 'reports'
12
- end
13
7
  end
@@ -2,12 +2,6 @@
2
2
 
3
3
  class RocketfuelApi::Service::ReportingDimension < RocketfuelApi::Service
4
4
  def initialize(connection)
5
- @read_only = true
6
-
7
5
  super(connection)
8
6
  end
9
-
10
- def uri_suffix
11
- 'reports/dimensions'
12
- end
13
7
  end
@@ -2,12 +2,6 @@
2
2
 
3
3
  class RocketfuelApi::Service::ReportingMetric < RocketfuelApi::Service
4
4
  def initialize(connection)
5
- @read_only = true
6
-
7
5
  super(connection)
8
6
  end
9
-
10
- def uri_suffix
11
- 'reports/metrics'
12
- end
13
7
  end
@@ -2,12 +2,6 @@
2
2
 
3
3
  class RocketfuelApi::Service::SubNetwork < RocketfuelApi::Service
4
4
  def initialize(connection)
5
- @read_only = true
6
-
7
5
  super(connection)
8
6
  end
9
-
10
- def uri_suffix
11
- 'sub_networks'
12
- end
13
7
  end
@@ -2,12 +2,6 @@
2
2
 
3
3
  class RocketfuelApi::Service::Tactic < RocketfuelApi::Service
4
4
  def initialize(connection)
5
- @read_only = true
6
-
7
5
  super(connection)
8
6
  end
9
-
10
- def uri_suffix
11
- 'tactics'
12
- end
13
7
  end
@@ -2,12 +2,6 @@
2
2
 
3
3
  class RocketfuelApi::Service::ThridPartyPixelSearch < RocketfuelApi::Service
4
4
  def initialize(connection)
5
- @read_only = true
6
-
7
5
  super(connection)
8
6
  end
9
-
10
- def uri_suffix
11
- 'thrid_party_pixels/search'
12
- end
13
7
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module RocketfuelApi
4
- VERSION = '0.1.1'
4
+ VERSION = '0.1.2'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rocketfuel_api
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Stefan Greffenius
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2017-09-11 00:00:00.000000000 Z
11
+ date: 2017-09-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday
@@ -126,6 +126,7 @@ files:
126
126
  - Rakefile
127
127
  - bin/console
128
128
  - bin/setup
129
+ - lib/config/endpoints_for_services.yaml
129
130
  - lib/rocketfuel_api.rb
130
131
  - lib/rocketfuel_api/connection.rb
131
132
  - lib/rocketfuel_api/error.rb