appnexusapi 0.0.1
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.
- data/.gitignore +18 -0
- data/Gemfile +4 -0
- data/LICENSE +22 -0
- data/README.md +56 -0
- data/Rakefile +2 -0
- data/appnexusapi.gemspec +20 -0
- data/lib/appnexusapi.rb +17 -0
- data/lib/appnexusapi/ad_server_resource.rb +2 -0
- data/lib/appnexusapi/ad_server_service.rb +20 -0
- data/lib/appnexusapi/bidder_instance_resource.rb +2 -0
- data/lib/appnexusapi/bidder_instance_service.rb +24 -0
- data/lib/appnexusapi/bidder_profile_resource.rb +2 -0
- data/lib/appnexusapi/bidder_profile_service.rb +24 -0
- data/lib/appnexusapi/bidder_resource.rb +2 -0
- data/lib/appnexusapi/bidder_service.rb +2 -0
- data/lib/appnexusapi/brand_resource.rb +2 -0
- data/lib/appnexusapi/brand_service.rb +8 -0
- data/lib/appnexusapi/browser_resource.rb +2 -0
- data/lib/appnexusapi/browser_service.rb +8 -0
- data/lib/appnexusapi/category_resource.rb +2 -0
- data/lib/appnexusapi/category_service.rb +12 -0
- data/lib/appnexusapi/connection.rb +65 -0
- data/lib/appnexusapi/content_category_resource.rb +2 -0
- data/lib/appnexusapi/content_category_service.rb +12 -0
- data/lib/appnexusapi/creative_resource.rb +2 -0
- data/lib/appnexusapi/creative_service.rb +12 -0
- data/lib/appnexusapi/domain_list_resource.rb +2 -0
- data/lib/appnexusapi/domain_list_service.rb +2 -0
- data/lib/appnexusapi/error.rb +15 -0
- data/lib/appnexusapi/faraday/encode_json.rb +15 -0
- data/lib/appnexusapi/faraday/parse_json.rb +59 -0
- data/lib/appnexusapi/faraday/raise_http_error.rb +41 -0
- data/lib/appnexusapi/inventory_attribute_resource.rb +2 -0
- data/lib/appnexusapi/inventory_attribute_service.rb +8 -0
- data/lib/appnexusapi/inventory_source_resource.rb +2 -0
- data/lib/appnexusapi/inventory_source_service.rb +2 -0
- data/lib/appnexusapi/language_resource.rb +2 -0
- data/lib/appnexusapi/language_service.rb +8 -0
- data/lib/appnexusapi/member_resource.rb +2 -0
- data/lib/appnexusapi/member_service.rb +2 -0
- data/lib/appnexusapi/operating_system_service.rb +8 -0
- data/lib/appnexusapi/platform_member_resource.rb +2 -0
- data/lib/appnexusapi/platform_member_service.rb +8 -0
- data/lib/appnexusapi/resource.rb +35 -0
- data/lib/appnexusapi/segment_resource.rb +2 -0
- data/lib/appnexusapi/segment_service.rb +12 -0
- data/lib/appnexusapi/service.rb +59 -0
- data/lib/appnexusapi/technical_attribute_resource.rb +2 -0
- data/lib/appnexusapi/technical_attribute_service.rb +8 -0
- data/lib/appnexusapi/tiny_tag_resource.rb +2 -0
- data/lib/appnexusapi/tiny_tag_service.rb +20 -0
- data/lib/appnexusapi/user_resource.rb +2 -0
- data/lib/appnexusapi/user_service.rb +2 -0
- data/lib/appnexusapi/version.rb +3 -0
- metadata +121 -0
data/.gitignore
ADDED
data/Gemfile
ADDED
data/LICENSE
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2012 Simpli.fi
|
2
|
+
|
3
|
+
MIT License
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,56 @@
|
|
1
|
+
# Appnexus API Wrapper
|
2
|
+
|
3
|
+
An unofficial Ruby API Wrapper for the Appnexus Service APIs.
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
Add this line to your application's Gemfile:
|
8
|
+
|
9
|
+
gem 'appnexusapi'
|
10
|
+
|
11
|
+
And then execute:
|
12
|
+
|
13
|
+
$ bundle
|
14
|
+
|
15
|
+
Or install it yourself as:
|
16
|
+
|
17
|
+
$ gem install appnexusapi
|
18
|
+
|
19
|
+
## Usage
|
20
|
+
|
21
|
+
Establish a connection:
|
22
|
+
|
23
|
+
connection = AppnexusApi::Connection.new({
|
24
|
+
# optionally pass a uri for the staging site
|
25
|
+
# defaults to "http://api.adnxs.com/"
|
26
|
+
# uri => "http://api.sand-08.adnxs.net",
|
27
|
+
username => 'username',
|
28
|
+
password => 'password'
|
29
|
+
})
|
30
|
+
|
31
|
+
Use a Service:
|
32
|
+
|
33
|
+
member_service = AppnexusApi::MemberService(connection)
|
34
|
+
# get always returns an array of results
|
35
|
+
# and defaults "num_elements" to 100 and "start_element" to 0
|
36
|
+
# and returns an AppnexusApi::Resource object which is a wrapper around the JSON
|
37
|
+
member = member_service.get.first
|
38
|
+
|
39
|
+
creative_service = AppnexusApi::CreativeService.new(connection, member.id)
|
40
|
+
|
41
|
+
new_creative = {
|
42
|
+
"media_url" => "http://ad.doubleclick.net/adi/ABC.Advertising.com/DEF.40;sz=300x250;click0=",
|
43
|
+
"width" => "300",
|
44
|
+
"height" => "250",
|
45
|
+
"format" => "url-html"
|
46
|
+
}
|
47
|
+
creative = creative_service.create(new_creative)
|
48
|
+
creative.update("campaign" => "Testing")
|
49
|
+
|
50
|
+
## Contributing
|
51
|
+
|
52
|
+
1. Fork it
|
53
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
54
|
+
3. Commit your changes (`git commit -am 'Added some feature'`)
|
55
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
56
|
+
5. Create new Pull Request
|
data/Rakefile
ADDED
data/appnexusapi.gemspec
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
require File.expand_path('../lib/appnexusapi/version', __FILE__)
|
3
|
+
|
4
|
+
Gem::Specification.new do |gem|
|
5
|
+
gem.authors = ["Brandon Aaron"]
|
6
|
+
gem.email = ["brandon.aaron@gmail.com"]
|
7
|
+
gem.description = %q{}
|
8
|
+
gem.summary = %q{Unofficial Ruby API Wrapper for Appnexus}
|
9
|
+
gem.homepage = "http://simpli.fi"
|
10
|
+
|
11
|
+
gem.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
12
|
+
gem.files = `git ls-files`.split("\n")
|
13
|
+
gem.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
14
|
+
gem.name = "appnexusapi"
|
15
|
+
gem.require_paths = ["lib"]
|
16
|
+
gem.version = AppnexusApi::VERSION
|
17
|
+
|
18
|
+
gem.add_dependency 'faraday', '~>0.7.6'
|
19
|
+
gem.add_dependency 'multi_json', '~> 1.0.3'
|
20
|
+
end
|
data/lib/appnexusapi.rb
ADDED
@@ -0,0 +1,17 @@
|
|
1
|
+
require "rubygems"
|
2
|
+
require "bundler/setup"
|
3
|
+
require "faraday"
|
4
|
+
require "appnexusapi/version"
|
5
|
+
require "appnexusapi/error"
|
6
|
+
|
7
|
+
module AppnexusApi
|
8
|
+
autoload :Connection, "appnexusapi/connection"
|
9
|
+
|
10
|
+
dir = File.dirname(__FILE__) + "/appnexusapi"
|
11
|
+
files = Dir.glob(File.expand_path("{*resource,*service}.rb", dir)).map{|f| File.basename(f, '.rb')}
|
12
|
+
files.each do |file|
|
13
|
+
sym = file.capitalize.gsub(/(_(.))/) { |c| $2.upcase }.to_sym
|
14
|
+
autoload sym, "appnexusapi/#{file}"
|
15
|
+
end
|
16
|
+
|
17
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
class AppnexusApi::AdServerService < AppnexusApi::Service
|
2
|
+
|
3
|
+
def initialize(connection)
|
4
|
+
@read_only = true
|
5
|
+
super(connection)
|
6
|
+
end
|
7
|
+
|
8
|
+
def name
|
9
|
+
"adserver"
|
10
|
+
end
|
11
|
+
|
12
|
+
def resource_class
|
13
|
+
ApnexusApi::AdServerResource
|
14
|
+
end
|
15
|
+
|
16
|
+
def uri_suffix
|
17
|
+
"ad-server"
|
18
|
+
end
|
19
|
+
|
20
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
class AppnexusApi::BidderInstanceService < AppnexusApi::Service
|
2
|
+
|
3
|
+
def initialize(connection, bidder_id)
|
4
|
+
@bidder_id = bidder_id
|
5
|
+
super(connection)
|
6
|
+
end
|
7
|
+
|
8
|
+
def name
|
9
|
+
"instance"
|
10
|
+
end
|
11
|
+
|
12
|
+
def resource_class
|
13
|
+
AppnexusApi::BidderInstanceResource
|
14
|
+
end
|
15
|
+
|
16
|
+
def uri_suffix
|
17
|
+
"bidder-instance/#{@bidder_id}"
|
18
|
+
end
|
19
|
+
|
20
|
+
def delete(id)
|
21
|
+
raise AppnexusApi::NotImplemented, "To remove an instance, please set it to inactive."
|
22
|
+
end
|
23
|
+
|
24
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
class AppnexusApi::BidderProfileResource < AppnexusApi::Service
|
2
|
+
|
3
|
+
def initialize(connection, bidder_id)
|
4
|
+
@bidder_id = bidder_id
|
5
|
+
super(connection)
|
6
|
+
end
|
7
|
+
|
8
|
+
def name
|
9
|
+
"profile"
|
10
|
+
end
|
11
|
+
|
12
|
+
def resource_class
|
13
|
+
AppnexusApi::BidderProfileResource
|
14
|
+
end
|
15
|
+
|
16
|
+
def uri_suffix
|
17
|
+
"bidder-profile/#{@bidder_id}"
|
18
|
+
end
|
19
|
+
|
20
|
+
def delete(id)
|
21
|
+
raise AppnexusApi::NotImplemented
|
22
|
+
end
|
23
|
+
|
24
|
+
end
|
@@ -0,0 +1,65 @@
|
|
1
|
+
require 'appnexusapi/faraday/encode_json'
|
2
|
+
require 'appnexusapi/faraday/parse_json'
|
3
|
+
require 'appnexusapi/faraday/raise_http_error'
|
4
|
+
|
5
|
+
class AppnexusApi::Connection
|
6
|
+
def initialize(config)
|
7
|
+
config["uri"] = "http://api.adnxs.com/" unless config.has_key?("uri")
|
8
|
+
@config = config
|
9
|
+
@connection = Faraday::Connection.new(:url => config["uri"]) do |builder|
|
10
|
+
builder.use AppnexusApi::Faraday::Request::JsonEncode
|
11
|
+
builder.use AppnexusApi::Faraday::Response::RaiseHttpError
|
12
|
+
builder.use AppnexusApi::Faraday::Response::ParseJson
|
13
|
+
builder.adapter Faraday.default_adapter
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
def is_authorized?
|
18
|
+
!@token.nil?
|
19
|
+
end
|
20
|
+
|
21
|
+
def login
|
22
|
+
response = @connection.run_request(:post, 'auth', { "auth" => { "username" => @config["username"], "password" => @config["password"] } }, {})
|
23
|
+
@token = response.body["token"]
|
24
|
+
end
|
25
|
+
|
26
|
+
def logout
|
27
|
+
@token = nil
|
28
|
+
end
|
29
|
+
|
30
|
+
def get(route, params={}, headers={})
|
31
|
+
params = params.delete_if {|key, value| value.nil? }
|
32
|
+
run_request(:get, @connection.build_url(route, params), nil, headers).body
|
33
|
+
end
|
34
|
+
|
35
|
+
def post(route, body=nil, headers={})
|
36
|
+
run_request(:post, route, body, headers).body
|
37
|
+
end
|
38
|
+
|
39
|
+
def put(route, body=nil, headers={})
|
40
|
+
run_request(:put, route, body, headers).body
|
41
|
+
end
|
42
|
+
|
43
|
+
def delete(route, body=nil, headers={})
|
44
|
+
run_request(:delete, route, body, headers).body
|
45
|
+
end
|
46
|
+
|
47
|
+
def run_request(method, route, body, headers)
|
48
|
+
login if !is_authorized?
|
49
|
+
begin
|
50
|
+
@connection.run_request(method, route, body, { "Authorization" => @token }.merge(headers))
|
51
|
+
rescue AppnexusApi::Unauthorized => e
|
52
|
+
if @retry == true
|
53
|
+
raise AppnexusApi::Unauthorized, e
|
54
|
+
else
|
55
|
+
@retry = true
|
56
|
+
logout
|
57
|
+
run_request(method, route, body, headers)
|
58
|
+
end
|
59
|
+
rescue Faraday::Error::TimeoutError => e
|
60
|
+
raise AppnexusApi::Timeout, "Timeout"
|
61
|
+
ensure
|
62
|
+
@retry = false
|
63
|
+
end
|
64
|
+
end
|
65
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
module AppnexusApi
|
2
|
+
class Error < StandardError; end
|
3
|
+
class BadRequest < Error; end
|
4
|
+
class Unauthorized < Error; end
|
5
|
+
class Forbidden < Error; end
|
6
|
+
class NotFound < Error; end
|
7
|
+
class NotAcceptable < Error; end
|
8
|
+
class UnprocessableEntity < Error; end
|
9
|
+
class InternalServerError < Error; end
|
10
|
+
class NotImplemented < Error; end
|
11
|
+
class BadGateway < Error; end
|
12
|
+
class ServiceUnavailable < Error; end
|
13
|
+
class InvalidJson < Error; end
|
14
|
+
class Timeout < Error; end
|
15
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
module AppnexusApi
|
2
|
+
module Faraday
|
3
|
+
module Request
|
4
|
+
class JsonEncode < ::Faraday::Middleware
|
5
|
+
def call(env)
|
6
|
+
if env[:request_headers]["Content-Type"] == nil
|
7
|
+
env[:body] = MultiJson.encode(env[:body]) if env[:body] != nil
|
8
|
+
env[:request_headers]["Content-Type"] = "application/json"
|
9
|
+
end
|
10
|
+
@app.call(env)
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,59 @@
|
|
1
|
+
module AppnexusApi
|
2
|
+
module Faraday
|
3
|
+
module Response
|
4
|
+
class ParseJson < ::Faraday::Middleware
|
5
|
+
dependency 'multi_json'
|
6
|
+
|
7
|
+
def call(env)
|
8
|
+
@app.call(env).on_complete do
|
9
|
+
if env[:response_headers]["content-type"].include?("application/json")
|
10
|
+
env[:body] = convert_to_json(env[:body])["response"]
|
11
|
+
check_for_error(env)
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
protected
|
17
|
+
|
18
|
+
def convert_to_json(body)
|
19
|
+
case body.strip
|
20
|
+
when ''
|
21
|
+
nil
|
22
|
+
when 'true'
|
23
|
+
true
|
24
|
+
when 'false'
|
25
|
+
false
|
26
|
+
else
|
27
|
+
begin
|
28
|
+
::MultiJson.decode(body)
|
29
|
+
rescue Exception => exception
|
30
|
+
raise AppnexusApi::InvalidJson
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
def check_for_error(env)
|
36
|
+
if env[:body].has_key?("error")
|
37
|
+
case env[:body]["error_id"]
|
38
|
+
when "NOAUTH"
|
39
|
+
raise AppnexusApi::Forbidden, error_message(env)
|
40
|
+
when "UNAUTH"
|
41
|
+
raise AppnexusApi::Unauthorized, error_message(env)
|
42
|
+
when "SYNTAX"
|
43
|
+
raise AppnexusApi::UnprocessableEntity, error_message(env)
|
44
|
+
when "SYSTEM"
|
45
|
+
raise AppnexusApi::InternalServerError, error_message(env)
|
46
|
+
when "INTEGRITY"
|
47
|
+
raise AppnexusApi::UnprocessableEntity, error_message(env)
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|
52
|
+
def error_message(env)
|
53
|
+
"#{env[:method].to_s.upcase} #{env[:url].to_s} (#{env[:body]["error_id"]}): #{env[:body]["error"]}"
|
54
|
+
end
|
55
|
+
|
56
|
+
end
|
57
|
+
end
|
58
|
+
end
|
59
|
+
end
|
@@ -0,0 +1,41 @@
|
|
1
|
+
module AppnexusApi
|
2
|
+
module Faraday
|
3
|
+
module Response
|
4
|
+
class RaiseHttpError < ::Faraday::Response::Middleware
|
5
|
+
def on_complete(response)
|
6
|
+
case response[:status].to_i
|
7
|
+
when 400
|
8
|
+
raise AppnexusApi::BadRequest, error_message(response)
|
9
|
+
when 401
|
10
|
+
raise AppnexusApi::Unauthorized, error_message(response)
|
11
|
+
when 403
|
12
|
+
raise AppnexusApi::Forbidden, error_message(response)
|
13
|
+
when 404
|
14
|
+
raise AppnexusApi::NotFound, error_message(response)
|
15
|
+
when 406
|
16
|
+
raise AppnexusApi::NotAcceptable, error_message(response)
|
17
|
+
when 422
|
18
|
+
raise AppnexusApi::UnprocessableEntity, error_message(response)
|
19
|
+
when 500
|
20
|
+
raise AppnexusApi::InternalServerError, error_message(response)
|
21
|
+
when 501
|
22
|
+
raise AppnexusApi::NotImplemented, error_message(response)
|
23
|
+
when 502
|
24
|
+
raise AppnexusApi::BadGateway, error_message(response)
|
25
|
+
when 503
|
26
|
+
raise AppnexusApi::ServiceUnavailable, error_message(response)
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
def error_message(response)
|
31
|
+
msg = "#{response[:method].to_s.upcase} #{response[:url].to_s}: #{response[:status]}"
|
32
|
+
if errors = response[:body] && response[:body]["errors"]
|
33
|
+
msg << "\n"
|
34
|
+
msg << errors.join("\n")
|
35
|
+
end
|
36
|
+
msg
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
@@ -0,0 +1,35 @@
|
|
1
|
+
class AppnexusApi::Resource
|
2
|
+
|
3
|
+
def initialize(json, service)
|
4
|
+
@json = json
|
5
|
+
@service = service
|
6
|
+
end
|
7
|
+
|
8
|
+
def update(attributes={})
|
9
|
+
resource = @service.update(id, attributes)
|
10
|
+
@json = resource.raw_json
|
11
|
+
end
|
12
|
+
|
13
|
+
def delete
|
14
|
+
@service.delete(id)
|
15
|
+
end
|
16
|
+
|
17
|
+
def raw_json
|
18
|
+
@json
|
19
|
+
end
|
20
|
+
|
21
|
+
def method_missing(sym, *args, &block)
|
22
|
+
if @json.respond_to?(sym)
|
23
|
+
@json.send(sym, *args, &block)
|
24
|
+
elsif @json.has_key?(sym.to_s)
|
25
|
+
return @json[sym.to_s]
|
26
|
+
else
|
27
|
+
super(sym, *args, &block)
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
def to_s
|
32
|
+
@json.inspect
|
33
|
+
end
|
34
|
+
|
35
|
+
end
|
@@ -0,0 +1,59 @@
|
|
1
|
+
class AppnexusApi::Service
|
2
|
+
|
3
|
+
def initialize(connection)
|
4
|
+
@connection = connection
|
5
|
+
end
|
6
|
+
|
7
|
+
def name
|
8
|
+
str = self.class.name.split("::").last.gsub("Service", "")
|
9
|
+
str.gsub(/(.)([A-Z])/, '\1_\2').downcase
|
10
|
+
end
|
11
|
+
|
12
|
+
def plural_name
|
13
|
+
name + 's'
|
14
|
+
end
|
15
|
+
|
16
|
+
def resource_class
|
17
|
+
resource_name = name.capitalize.gsub(/(_(.))/) { |c| $2.upcase }
|
18
|
+
AppnexusApi.const_get(resource_name + "Resource")
|
19
|
+
end
|
20
|
+
|
21
|
+
def uri_suffix
|
22
|
+
name.gsub('_', '-')
|
23
|
+
end
|
24
|
+
|
25
|
+
def get(params={})
|
26
|
+
params = {
|
27
|
+
"num_elements" => 100,
|
28
|
+
"start_element" => 0
|
29
|
+
}.merge(params)
|
30
|
+
response = @connection.get(uri_suffix, params)
|
31
|
+
if response.has_key?(plural_name)
|
32
|
+
response[plural_name].map do |json|
|
33
|
+
resource_class.new(json, self)
|
34
|
+
end
|
35
|
+
elsif response.has_key?(name)
|
36
|
+
[resource_class.new(response[name], self)]
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
def create(attributes={})
|
41
|
+
raise(AppnexusApi::NotImplemented, "Service is read-only.") if @read_only
|
42
|
+
attributes = { name => attributes }
|
43
|
+
response = @connection.post(uri_suffix, attributes)
|
44
|
+
get("id" => response["id"]).first
|
45
|
+
end
|
46
|
+
|
47
|
+
def update(id, attributes={})
|
48
|
+
raise(AppnexusApi::NotImplemented, "Service is read-only.") if @read_only
|
49
|
+
attributes = { name => attributes }
|
50
|
+
response = @connection.put([uri_suffix, id].join('/'), attributes)
|
51
|
+
get("id" => response["id"]).first
|
52
|
+
end
|
53
|
+
|
54
|
+
def delete(id)
|
55
|
+
raise(AppnexusApi::NotImplemented, "Service is read-only.") if @read_only
|
56
|
+
@connection.delete([uri_suffix, id].join('/'))
|
57
|
+
end
|
58
|
+
|
59
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
class AppnexusApi::TinyTagService < AppnexusApi::Service
|
2
|
+
|
3
|
+
def initialize(connection, member_id)
|
4
|
+
@member_id = member_id
|
5
|
+
super(connection)
|
6
|
+
end
|
7
|
+
|
8
|
+
def name
|
9
|
+
"tinytag"
|
10
|
+
end
|
11
|
+
|
12
|
+
def resource_class
|
13
|
+
AppnexusApi::TinyTagResource
|
14
|
+
end
|
15
|
+
|
16
|
+
def uri_suffix
|
17
|
+
"tt/#{@member_id}"
|
18
|
+
end
|
19
|
+
|
20
|
+
end
|
metadata
ADDED
@@ -0,0 +1,121 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: appnexusapi
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
prerelease:
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- Brandon Aaron
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2012-07-16 00:00:00.000000000Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: faraday
|
16
|
+
requirement: &2153240400 !ruby/object:Gem::Requirement
|
17
|
+
none: false
|
18
|
+
requirements:
|
19
|
+
- - ~>
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: 0.7.6
|
22
|
+
type: :runtime
|
23
|
+
prerelease: false
|
24
|
+
version_requirements: *2153240400
|
25
|
+
- !ruby/object:Gem::Dependency
|
26
|
+
name: multi_json
|
27
|
+
requirement: &2153238400 !ruby/object:Gem::Requirement
|
28
|
+
none: false
|
29
|
+
requirements:
|
30
|
+
- - ~>
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: 1.0.3
|
33
|
+
type: :runtime
|
34
|
+
prerelease: false
|
35
|
+
version_requirements: *2153238400
|
36
|
+
description: ''
|
37
|
+
email:
|
38
|
+
- brandon.aaron@gmail.com
|
39
|
+
executables: []
|
40
|
+
extensions: []
|
41
|
+
extra_rdoc_files: []
|
42
|
+
files:
|
43
|
+
- .gitignore
|
44
|
+
- Gemfile
|
45
|
+
- LICENSE
|
46
|
+
- README.md
|
47
|
+
- Rakefile
|
48
|
+
- appnexusapi.gemspec
|
49
|
+
- lib/appnexusapi.rb
|
50
|
+
- lib/appnexusapi/ad_server_resource.rb
|
51
|
+
- lib/appnexusapi/ad_server_service.rb
|
52
|
+
- lib/appnexusapi/bidder_instance_resource.rb
|
53
|
+
- lib/appnexusapi/bidder_instance_service.rb
|
54
|
+
- lib/appnexusapi/bidder_profile_resource.rb
|
55
|
+
- lib/appnexusapi/bidder_profile_service.rb
|
56
|
+
- lib/appnexusapi/bidder_resource.rb
|
57
|
+
- lib/appnexusapi/bidder_service.rb
|
58
|
+
- lib/appnexusapi/brand_resource.rb
|
59
|
+
- lib/appnexusapi/brand_service.rb
|
60
|
+
- lib/appnexusapi/browser_resource.rb
|
61
|
+
- lib/appnexusapi/browser_service.rb
|
62
|
+
- lib/appnexusapi/category_resource.rb
|
63
|
+
- lib/appnexusapi/category_service.rb
|
64
|
+
- lib/appnexusapi/connection.rb
|
65
|
+
- lib/appnexusapi/content_category_resource.rb
|
66
|
+
- lib/appnexusapi/content_category_service.rb
|
67
|
+
- lib/appnexusapi/creative_resource.rb
|
68
|
+
- lib/appnexusapi/creative_service.rb
|
69
|
+
- lib/appnexusapi/domain_list_resource.rb
|
70
|
+
- lib/appnexusapi/domain_list_service.rb
|
71
|
+
- lib/appnexusapi/error.rb
|
72
|
+
- lib/appnexusapi/faraday/encode_json.rb
|
73
|
+
- lib/appnexusapi/faraday/parse_json.rb
|
74
|
+
- lib/appnexusapi/faraday/raise_http_error.rb
|
75
|
+
- lib/appnexusapi/inventory_attribute_resource.rb
|
76
|
+
- lib/appnexusapi/inventory_attribute_service.rb
|
77
|
+
- lib/appnexusapi/inventory_source_resource.rb
|
78
|
+
- lib/appnexusapi/inventory_source_service.rb
|
79
|
+
- lib/appnexusapi/language_resource.rb
|
80
|
+
- lib/appnexusapi/language_service.rb
|
81
|
+
- lib/appnexusapi/member_resource.rb
|
82
|
+
- lib/appnexusapi/member_service.rb
|
83
|
+
- lib/appnexusapi/operating_system_service.rb
|
84
|
+
- lib/appnexusapi/platform_member_resource.rb
|
85
|
+
- lib/appnexusapi/platform_member_service.rb
|
86
|
+
- lib/appnexusapi/resource.rb
|
87
|
+
- lib/appnexusapi/segment_resource.rb
|
88
|
+
- lib/appnexusapi/segment_service.rb
|
89
|
+
- lib/appnexusapi/service.rb
|
90
|
+
- lib/appnexusapi/technical_attribute_resource.rb
|
91
|
+
- lib/appnexusapi/technical_attribute_service.rb
|
92
|
+
- lib/appnexusapi/tiny_tag_resource.rb
|
93
|
+
- lib/appnexusapi/tiny_tag_service.rb
|
94
|
+
- lib/appnexusapi/user_resource.rb
|
95
|
+
- lib/appnexusapi/user_service.rb
|
96
|
+
- lib/appnexusapi/version.rb
|
97
|
+
homepage: http://simpli.fi
|
98
|
+
licenses: []
|
99
|
+
post_install_message:
|
100
|
+
rdoc_options: []
|
101
|
+
require_paths:
|
102
|
+
- lib
|
103
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
104
|
+
none: false
|
105
|
+
requirements:
|
106
|
+
- - ! '>='
|
107
|
+
- !ruby/object:Gem::Version
|
108
|
+
version: '0'
|
109
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
110
|
+
none: false
|
111
|
+
requirements:
|
112
|
+
- - ! '>='
|
113
|
+
- !ruby/object:Gem::Version
|
114
|
+
version: '0'
|
115
|
+
requirements: []
|
116
|
+
rubyforge_project:
|
117
|
+
rubygems_version: 1.8.10
|
118
|
+
signing_key:
|
119
|
+
specification_version: 3
|
120
|
+
summary: Unofficial Ruby API Wrapper for Appnexus
|
121
|
+
test_files: []
|