yahoo_gemini_client 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 769db0035a436bc993c65ab58afc37887e805e81
4
+ data.tar.gz: 1f53ca079d78a3d734fd7a876d3644620afef740
5
+ SHA512:
6
+ metadata.gz: 2f3225a7ac8057a2a300dc5c949f6a3c544826aa053bc26a34af6d786f11f0d9545ad442e6bcfdbb9723485581e637029e775adfeadb2405fa7838e401dc5b2f
7
+ data.tar.gz: f8976c73c408d42d04d7f0439e59d22c029898d620f1113fb3e7046e3851e3b472b8a3f1100819690f7a4b4d7c05a7a4e361cd173373fadb615e5af0cad1c45c
data/.env ADDED
@@ -0,0 +1,6 @@
1
+ YAHOO_GEMINI_TEST_CONSUMER_KEY=get_consumer_key
2
+ YAHOO_GEMINI_TEST_CONSUMER_SECRET=get_consumer_secret
3
+ YAHOO_GEMINI_TEST_AUTHORIZATION_CODE=get_authorization_code
4
+ YAHOO_GEMINI_TEST_ACCESS_TOKEN=get_access_token
5
+ YAHOO_GEMINI_TEST_REFRESH_TOKEN=get_refresh_token
6
+
data/.gitignore ADDED
@@ -0,0 +1,11 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /Gemfile.lock
4
+ /_yardoc/
5
+ /coverage/
6
+ /doc/
7
+ /pkg/
8
+ /spec/reports/
9
+ /tmp/
10
+ spec/config.yml
11
+ .env.override
data/.rspec ADDED
@@ -0,0 +1,2 @@
1
+ --format documentation
2
+ --color
data/.ruby_version ADDED
@@ -0,0 +1 @@
1
+ 2.2.2
data/.travis.yml ADDED
@@ -0,0 +1,4 @@
1
+ language: ruby
2
+ rvm:
3
+ - 2.2.2
4
+ before_install: gem install bundler -v 1.10.6
data/CHANGELOG.md ADDED
@@ -0,0 +1,3 @@
1
+ # 0.0.1
2
+
3
+ - Initial release
@@ -0,0 +1,13 @@
1
+ # Contributor Code of Conduct
2
+
3
+ As contributors and maintainers of this project, we pledge to respect all people who contribute through reporting issues, posting feature requests, updating documentation, submitting pull requests or patches, and other activities.
4
+
5
+ We are committed to making participation in this project a harassment-free experience for everyone, regardless of level of experience, gender, gender identity and expression, sexual orientation, disability, personal appearance, body size, race, ethnicity, age, or religion.
6
+
7
+ Examples of unacceptable behavior by participants include the use of sexual language or imagery, derogatory comments or personal attacks, trolling, public or private harassment, insults, or other unprofessional conduct.
8
+
9
+ Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct. Project maintainers who do not follow the Code of Conduct may be removed from the project team.
10
+
11
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by opening an issue or contacting one or more of the project maintainers.
12
+
13
+ This Code of Conduct is adapted from the [Contributor Covenant](http://contributor-covenant.org), version 1.0.0, available at [http://contributor-covenant.org/version/1/0/0/](http://contributor-covenant.org/version/1/0/0/)
data/Gemfile ADDED
@@ -0,0 +1,6 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in yahoo_gemini_client.gemspec
4
+ gemspec
5
+
6
+ gem 'pry'
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2015 Ramon Tayag
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
data/MIT-LICENSE.md ADDED
@@ -0,0 +1,9 @@
1
+ Copyright (c) 2015 G5
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
6
+
7
+ The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
8
+
9
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,102 @@
1
+ # YahooGeminiClient
2
+
3
+ Ruby wrapper for the Yahoo! Gemini API
4
+
5
+ ## Installation
6
+
7
+ Add this line to your application's Gemfile:
8
+
9
+ ```ruby
10
+ gem 'yahoo_gemini_client'
11
+ ```
12
+
13
+ And then execute:
14
+
15
+ $ bundle
16
+
17
+ Or install it yourself as:
18
+
19
+ $ gem install yahoo_gemini_client
20
+
21
+ ## Usage
22
+
23
+ ```ruby
24
+ # Currently supports OAuth2 Auth Code Strategy (Explicit Grant Flow) only
25
+ # see https://developer.yahoo.com/oauth2/guide/flows_authcode/
26
+
27
+ client = YahooGeminiClient::Client.new(
28
+ client_id: "consumer_key",
29
+ client_secret: "consumer_secret",
30
+ refresh_token: "refresh_token"
31
+ )
32
+
33
+ client.authorization_url # returns authorization url
34
+
35
+ # visit authorization url returned in a web browser to get the Authorization Code
36
+ # assuming you've got an authentication code...
37
+
38
+ client.get_token(authorization_code)
39
+
40
+ # Advertisers endpoint
41
+ client.advertisers.each { |advertiser| puts advertiser.advertiser_name }
42
+ client.advertisers.find(123)
43
+ ```
44
+
45
+ ### Custom Reports
46
+
47
+ #### Requesting Yahoo.com to create a custom report with a given cube
48
+
49
+ ```ruby
50
+ request_body = { "cube": "performance_stats",
51
+ "fields": [
52
+ { "field": "Ad ID" },
53
+ { "field": "Day" },
54
+ { "alias": "My dummy column", "value": "" },
55
+ { "field": "Impressions" },
56
+ { "field": "Ad Image URL", "alias": "url" }
57
+ ],
58
+
59
+ "filters": [
60
+ { "field": "Advertiser ID", "operator": "=", "value": 12345 },
61
+ { "field": "Campaign ID", "operator": "IN", "values": [10,20,30] },
62
+ { "field": "Day", "operator": "between", "from": "2014-04-01", "to": "2014-04-30" }
63
+ ]
64
+ }
65
+
66
+ response = client.custom_report.create(request_body)
67
+ response.error? # check if response is error
68
+ response.job_id # get the report request token of the report creation job request at Yahoo.com
69
+ ```
70
+
71
+ #### Checking the status of the requested report from Yahoo.com
72
+
73
+ ```ruby
74
+ params = {advertiser_id: 12345, job_id: "86ea9ba1c645e7a33bddfc06ee5c799fa40d02ce49632927"}
75
+ response = client.custom_report.find(params)
76
+ response.error? # check if response is error
77
+ response.completed? # check if report creation at Yahoo.com is complete
78
+ response.csv_url # get the csv url of the created report
79
+ ```
80
+
81
+ ## Development
82
+
83
+ After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
84
+
85
+ To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
86
+
87
+ ## Contributing
88
+
89
+ Bug reports and pull requests are welcome on GitHub at https://github.com/g5/yahoo_gemini_client. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](contributor-covenant.org) code of conduct.
90
+
91
+
92
+ ## License
93
+
94
+ Copyright (c) 2015 G5
95
+
96
+ MIT License
97
+
98
+ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
99
+
100
+ The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
101
+
102
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/Rakefile ADDED
@@ -0,0 +1,6 @@
1
+ require "bundler/gem_tasks"
2
+ require "rspec/core/rake_task"
3
+
4
+ RSpec::Core::RakeTask.new(:spec)
5
+
6
+ task :default => :spec
data/bin/console ADDED
@@ -0,0 +1,26 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "yahoo_gemini_client"
5
+ require "dotenv"
6
+ Dotenv.load
7
+ Dotenv.overload ".env.override"
8
+
9
+ # You can add fixtures and/or initialization code here to make experimenting
10
+ # with your gem easier. You can also use a different console, if you like.
11
+
12
+ # (If you use this, don't forget to add pry to your Gemfile!)
13
+ # require "pry"
14
+ # Pry.start
15
+ def client
16
+ @client ||= YahooGeminiClient::Client.new(
17
+ consumer_key: ENV["YAHOO_GEMINI_TEST_CONSUMER_KEY"],
18
+ consumer_secret: ENV["YAHOO_GEMINI_TEST_CONSUMER_SECRET"],
19
+ token: { refresh_token: ENV["YAHOO_GEMINI_TEST_REFRESH_TOKEN"] }
20
+ )
21
+ end
22
+ puts "Visit authorize url to get new authorization code here:"
23
+ puts client.authorization_url
24
+
25
+ require "irb"
26
+ IRB.start
data/bin/setup ADDED
@@ -0,0 +1,15 @@
1
+ #!/bin/bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+
5
+ bundle install
6
+
7
+ # Do any other automated setup that you need to do here
8
+
9
+ if [ ! -f .env.override ];
10
+ then
11
+ echo 'Copying .env to .env.override. You need to override most, if not all, of the ENV variables there:'
12
+ cp .env .env.override
13
+ else
14
+ echo '.env.override already exists. Check the environment variables that you need to override'
15
+ fi
@@ -0,0 +1,24 @@
1
+ require "active_model"
2
+ require "httparty"
3
+ require "virtus"
4
+ require "active_support/core_ext/hash/indifferent_access"
5
+ require "yahoo_gemini_client/version"
6
+ require "yahoo_gemini_client/client"
7
+ require "yahoo_gemini_client/generate_member_uri"
8
+ require "yahoo_gemini_client/collection"
9
+ require "yahoo_gemini_client/advertisers"
10
+ require "yahoo_gemini_client/advertiser"
11
+ require "yahoo_gemini_client/services/custom_report"
12
+ require "yahoo_gemini_client/responses/base_response"
13
+ require "yahoo_gemini_client/requests/base_request"
14
+ require "yahoo_gemini_client/requests/custom_report_job_request"
15
+ require "yahoo_gemini_client/requests/custom_report_check_job_request"
16
+ require "yahoo_gemini_client/responses/custom_report_response"
17
+
18
+ module YahooGeminiClient
19
+
20
+ def self.new(*args)
21
+ Client.new(*args)
22
+ end
23
+
24
+ end
@@ -0,0 +1,49 @@
1
+ module YahooGeminiClient
2
+ class Advertiser
3
+
4
+ def initialize(hash)
5
+ @hash = hash
6
+ end
7
+
8
+ def id
9
+ @hash["id"]
10
+ end
11
+
12
+ def advertiser_name
13
+ @hash["advertiserName"]
14
+ end
15
+
16
+ def billing_country
17
+ @hash["billingCountry"]
18
+ end
19
+
20
+ def booking_country
21
+ @hash["bookingCountry"]
22
+ end
23
+
24
+ def currency
25
+ @hash["currency"]
26
+ end
27
+
28
+ def language
29
+ @hash["language"]
30
+ end
31
+
32
+ def managed_by
33
+ @hash["managedBy"]
34
+ end
35
+
36
+ def status
37
+ @hash["status"]
38
+ end
39
+
40
+ def timezone
41
+ @hash["timezone"]
42
+ end
43
+
44
+ def type
45
+ @hash["type"]
46
+ end
47
+
48
+ end
49
+ end
@@ -0,0 +1,22 @@
1
+ module YahooGeminiClient
2
+ class Advertisers < Collection
3
+
4
+ def all
5
+ response = get(base_uri)
6
+ response.map do |advertiser_hash|
7
+ Advertiser.new(advertiser_hash)
8
+ end
9
+ end
10
+
11
+ def find(ids)
12
+ uri = GenerateMemberURI.execute(base_uri, ids)
13
+ response = get(uri.to_s)
14
+ response.map { |advertiser_hash| Advertiser.new(advertiser_hash) }
15
+ end
16
+
17
+ def base_uri
18
+ 'https://api.admanager.yahoo.com/v1/rest/advertiser/'
19
+ end
20
+
21
+ end
22
+ end
@@ -0,0 +1,83 @@
1
+ require "oauth2"
2
+
3
+ module YahooGeminiClient
4
+ class Client
5
+ attr_accessor(
6
+ :consumer_key,
7
+ :consumer_secret,
8
+ :oauth2_client,
9
+ :token,
10
+ )
11
+
12
+ def initialize(options={})
13
+ @consumer_key = options[:consumer_key]
14
+ @consumer_secret = options[:consumer_secret]
15
+ @refresh_token = options[:refresh_token]
16
+ @oauth2_client ||= OAuth2::Client.new(consumer_key, consumer_secret, {
17
+ :site => 'https://api.login.yahoo.com',
18
+ :authorize_url => '/oauth2/request_auth',
19
+ :token_url => '/oauth2/get_token',
20
+ })
21
+ if options[:token]
22
+ @token = OAuth2::AccessToken.from_hash(
23
+ @oauth2_client,
24
+ options[:token]
25
+ )
26
+ end
27
+ end
28
+
29
+ def authorization_url
30
+ oauth2_client.auth_code.authorize_url(
31
+ :redirect_uri => "oob",
32
+ :response_type => "code",
33
+ :language => "en-us",
34
+ )
35
+ end
36
+
37
+ def encoded_creds
38
+ Base64.encode64("#{consumer_key}:#{consumer_secret}").gsub(/\n/,"").strip
39
+ end
40
+
41
+ def get_token(authorization_code)
42
+ self.token = oauth2_client.auth_code.get_token(authorization_code, {
43
+ :redirect_uri => 'oob',
44
+ :headers => oauth2_headers,
45
+ })
46
+ end
47
+
48
+ def oauth2_headers
49
+ {
50
+ 'Authorization' => "Basic #{encoded_creds}",
51
+ 'Content-Type' => 'application/x-www-form-urlencoded',
52
+ 'User-Agent' => user_agent,
53
+ }
54
+ end
55
+
56
+ def api_request_headers
57
+ {
58
+ "Authorization" => "Bearer #{token.token}",
59
+ "User-Agent" => user_agent,
60
+ }
61
+ end
62
+
63
+ def user_agent
64
+ @user_agent ||= "YahooGeminiClientRubyGem/#{YahooGeminiClient::VERSION}"
65
+ end
66
+
67
+ def advertisers
68
+ Advertisers.new(client: self)
69
+ end
70
+
71
+ def token_refresh!
72
+ self.token = self.token.refresh!({
73
+ :redirect_uri => 'oob',
74
+ :headers => oauth2_headers
75
+ })
76
+ end
77
+
78
+ def custom_report
79
+ CustomReport.new(client: self)
80
+ end
81
+
82
+ end
83
+ end
@@ -0,0 +1,41 @@
1
+ module YahooGeminiClient
2
+ class Collection
3
+
4
+ attr_reader :client
5
+ include Enumerable
6
+
7
+ def initialize(opts={})
8
+ @client = opts[:client]
9
+ end
10
+
11
+ def api_request_headers
12
+ client.api_request_headers
13
+ end
14
+
15
+ def each
16
+ @members ||= all
17
+ @members.each { |member| yield member }
18
+ end
19
+
20
+ private
21
+
22
+ def get(uri)
23
+ response = HTTParty.get(uri, headers: api_request_headers)
24
+ if response.success?
25
+ JSON.parse(response.body).with_indifferent_access[:response]
26
+ else
27
+ # TODO testme
28
+ raise "Reponse Unsuccessful: #{response.body}"
29
+ end
30
+ end
31
+
32
+ def member_uri(ids)
33
+ GenerateMemberURI.execute(ids)
34
+ end
35
+
36
+ def base_uri
37
+ raise 'This must be overriden'
38
+ end
39
+
40
+ end
41
+ end
@@ -0,0 +1,12 @@
1
+ module YahooGeminiClient
2
+ class GenerateMemberURI
3
+
4
+ def self.execute(base_uri, ids)
5
+ uri = URI.parse(base_uri)
6
+ ids = [ids].flatten
7
+ uri.query = ids.map { |id| "id=#{id}" }.join("&")
8
+ uri.to_s
9
+ end
10
+
11
+ end
12
+ end
@@ -0,0 +1,52 @@
1
+ module YahooGeminiClient
2
+ class BaseRequest
3
+
4
+ HTTP_REQUEST_HEADER = {"Content-Type" => "application/json"}
5
+
6
+ include Virtus.model
7
+ attribute :url, String
8
+ attribute :client_id, String
9
+ attribute :client_secret, String
10
+ attribute :refresh_key, String
11
+ attribute :client
12
+
13
+ include ActiveModel::Validations
14
+ validates :url, :client_id, :client_secret, :refresh_key, presence: true
15
+
16
+ def self.execute(*args)
17
+ self.new(*args).execute
18
+ end
19
+
20
+ private
21
+
22
+ def default_opts(additional_opts)
23
+ attributes.slice(:url).merge(action: action_name).
24
+ merge(additional_opts)
25
+ end
26
+
27
+ def action_name
28
+ self.class.name.demodulize.gsub("Request", "").underscore.to_sym
29
+ end
30
+
31
+ # def client
32
+ # @client ||= Client.new(
33
+ # consumer_key: ENV["YAHOO_GEMINI_TEST_CONSUMER_KEY"],
34
+ # consumer_secret: ENV["YAHOO_GEMINI_TEST_CONSUMER_SECRET"],
35
+ # token: {
36
+ # refresh_token: ENV["YAHOO_GEMINI_TEST_REFRESH_TOKEN"],
37
+ # }
38
+ # )
39
+ # end
40
+
41
+ protected
42
+
43
+ def access_token
44
+ @token ||= client.token_refresh!
45
+ @token.token
46
+ end
47
+
48
+ def http_request_header
49
+ HTTP_REQUEST_HEADER
50
+ end
51
+ end
52
+ end
@@ -0,0 +1,27 @@
1
+ module YahooGeminiClient
2
+ class CustomReportCheckJobRequest < BaseRequest
3
+ REQUEST_URI = "https://api.admanager.yahoo.com/v1/rest/reports/custom/"
4
+
5
+ attribute :request_body, String
6
+ attribute :advertiser_id, String
7
+ attribute :job_id, String
8
+
9
+ def execute
10
+ http_authorization_header = {"Authorization" => "Bearer #{access_token}"}
11
+ response = HTTParty.get(build_request_uri,
12
+ headers: http_request_header.merge(http_authorization_header),
13
+ )
14
+ CustomReportResponse.new(response.with_indifferent_access)
15
+ end
16
+
17
+ private
18
+
19
+ def build_request_uri
20
+ REQUEST_URI + job_id + advertiser_id_http_parameter
21
+ end
22
+
23
+ def advertiser_id_http_parameter
24
+ "?advertiserId=#{advertiser_id}"
25
+ end
26
+ end
27
+ end
@@ -0,0 +1,16 @@
1
+ module YahooGeminiClient
2
+ class CustomReportJobRequest < BaseRequest
3
+ REQUEST_URI = "https://api.admanager.yahoo.com/v1/rest/reports/custom"
4
+
5
+ attribute :request_body
6
+
7
+ def execute
8
+ http_authorization_header = {"Authorization" => "Bearer #{access_token}"}
9
+ response = HTTParty.post(REQUEST_URI,
10
+ headers: http_request_header.merge(http_authorization_header),
11
+ body: request_body.to_json,
12
+ )
13
+ CustomReportResponse.new(response.with_indifferent_access)
14
+ end
15
+ end
16
+ end
@@ -0,0 +1,5 @@
1
+ module YahooGeminiClient
2
+ class BaseResponse
3
+
4
+ end
5
+ end
@@ -0,0 +1,23 @@
1
+ module YahooGeminiClient
2
+ class CustomReportResponse
3
+ attr_accessor :errors, :timestamp, :job_id, :status, :csv_url
4
+
5
+ def initialize(json_response)
6
+ @errors = json_response[:errors]
7
+ @timestamp = json_response[:timestamp]
8
+ if json_response[:response]
9
+ @job_id = json_response[:response][:jobId]
10
+ @status = json_response[:response][:status]
11
+ @csv_url = json_response[:response][:jobResponse]
12
+ end
13
+ end
14
+
15
+ def error?
16
+ !@errors.nil?
17
+ end
18
+
19
+ def completed?
20
+ @status == "completed"
21
+ end
22
+ end
23
+ end
@@ -0,0 +1,16 @@
1
+ module YahooGeminiClient
2
+ class CustomReport
3
+ def initialize(opts={})
4
+ @client = opts[:client]
5
+ end
6
+
7
+ def create(request_body)
8
+ CustomReportJobRequest.new(request_body: request_body, client: @client).
9
+ execute
10
+ end
11
+
12
+ def find(params)
13
+ CustomReportCheckJobRequest.new(params.merge(client: @client)).execute
14
+ end
15
+ end
16
+ end
@@ -0,0 +1,3 @@
1
+ module YahooGeminiClient
2
+ VERSION = "0.0.1"
3
+ end
@@ -0,0 +1,42 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'yahoo_gemini_client/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "yahoo_gemini_client"
8
+ spec.version = YahooGeminiClient::VERSION
9
+ spec.authors = ["Ramon Tayag", "Marc Ignacio"]
10
+ spec.email = ["ramon.tayag@gmail.com", "marcrendlignacio@gmail.com"]
11
+
12
+ spec.summary = %q{A Ruby Interface to the Yahoo Gemini API}
13
+ spec.description = %q{A Ruby Interface to the Yahoo Gemini API}
14
+ spec.homepage = "http://github.com/g5/yahoo_gemini_client"
15
+ spec.license = "MIT"
16
+
17
+ if spec.respond_to?(:metadata)
18
+ spec.metadata['allowed_push_host'] = "https://rubygems.org"
19
+ else
20
+ raise "RubyGems 2.0 or newer is required to protect against public gem pushes."
21
+ end
22
+
23
+ spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
24
+ spec.bindir = "exe"
25
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
26
+ spec.require_paths = ["lib"]
27
+
28
+ spec.add_dependency "oauth2", "~> 1.0"
29
+ spec.add_dependency "httparty", "~> 0.13"
30
+ spec.add_dependency "activesupport", ">= 3.0"
31
+ spec.add_dependency "activemodel"
32
+ spec.add_dependency "virtus", "~> 1.0"
33
+ spec.add_development_dependency "vcr", "~> 2.9"
34
+ spec.add_development_dependency "webmock", "~> 1.21"
35
+ spec.add_development_dependency "dotenv", "~> 2.0"
36
+ spec.add_development_dependency "bundler", "~> 1.10"
37
+ spec.add_development_dependency "rake", "~> 10.0"
38
+ spec.add_development_dependency "rspec", "~> 3.3"
39
+ spec.add_development_dependency "rspec-its", "~> 1.0"
40
+ spec.add_development_dependency "virtus-matchers"
41
+ spec.add_development_dependency "shoulda-matchers"
42
+ end
metadata ADDED
@@ -0,0 +1,271 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: yahoo_gemini_client
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Ramon Tayag
8
+ - Marc Ignacio
9
+ autorequire:
10
+ bindir: exe
11
+ cert_chain: []
12
+ date: 2015-08-06 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: oauth2
16
+ requirement: !ruby/object:Gem::Requirement
17
+ requirements:
18
+ - - "~>"
19
+ - !ruby/object:Gem::Version
20
+ version: '1.0'
21
+ type: :runtime
22
+ prerelease: false
23
+ version_requirements: !ruby/object:Gem::Requirement
24
+ requirements:
25
+ - - "~>"
26
+ - !ruby/object:Gem::Version
27
+ version: '1.0'
28
+ - !ruby/object:Gem::Dependency
29
+ name: httparty
30
+ requirement: !ruby/object:Gem::Requirement
31
+ requirements:
32
+ - - "~>"
33
+ - !ruby/object:Gem::Version
34
+ version: '0.13'
35
+ type: :runtime
36
+ prerelease: false
37
+ version_requirements: !ruby/object:Gem::Requirement
38
+ requirements:
39
+ - - "~>"
40
+ - !ruby/object:Gem::Version
41
+ version: '0.13'
42
+ - !ruby/object:Gem::Dependency
43
+ name: activesupport
44
+ requirement: !ruby/object:Gem::Requirement
45
+ requirements:
46
+ - - ">="
47
+ - !ruby/object:Gem::Version
48
+ version: '3.0'
49
+ type: :runtime
50
+ prerelease: false
51
+ version_requirements: !ruby/object:Gem::Requirement
52
+ requirements:
53
+ - - ">="
54
+ - !ruby/object:Gem::Version
55
+ version: '3.0'
56
+ - !ruby/object:Gem::Dependency
57
+ name: activemodel
58
+ requirement: !ruby/object:Gem::Requirement
59
+ requirements:
60
+ - - ">="
61
+ - !ruby/object:Gem::Version
62
+ version: '0'
63
+ type: :runtime
64
+ prerelease: false
65
+ version_requirements: !ruby/object:Gem::Requirement
66
+ requirements:
67
+ - - ">="
68
+ - !ruby/object:Gem::Version
69
+ version: '0'
70
+ - !ruby/object:Gem::Dependency
71
+ name: virtus
72
+ requirement: !ruby/object:Gem::Requirement
73
+ requirements:
74
+ - - "~>"
75
+ - !ruby/object:Gem::Version
76
+ version: '1.0'
77
+ type: :runtime
78
+ prerelease: false
79
+ version_requirements: !ruby/object:Gem::Requirement
80
+ requirements:
81
+ - - "~>"
82
+ - !ruby/object:Gem::Version
83
+ version: '1.0'
84
+ - !ruby/object:Gem::Dependency
85
+ name: vcr
86
+ requirement: !ruby/object:Gem::Requirement
87
+ requirements:
88
+ - - "~>"
89
+ - !ruby/object:Gem::Version
90
+ version: '2.9'
91
+ type: :development
92
+ prerelease: false
93
+ version_requirements: !ruby/object:Gem::Requirement
94
+ requirements:
95
+ - - "~>"
96
+ - !ruby/object:Gem::Version
97
+ version: '2.9'
98
+ - !ruby/object:Gem::Dependency
99
+ name: webmock
100
+ requirement: !ruby/object:Gem::Requirement
101
+ requirements:
102
+ - - "~>"
103
+ - !ruby/object:Gem::Version
104
+ version: '1.21'
105
+ type: :development
106
+ prerelease: false
107
+ version_requirements: !ruby/object:Gem::Requirement
108
+ requirements:
109
+ - - "~>"
110
+ - !ruby/object:Gem::Version
111
+ version: '1.21'
112
+ - !ruby/object:Gem::Dependency
113
+ name: dotenv
114
+ requirement: !ruby/object:Gem::Requirement
115
+ requirements:
116
+ - - "~>"
117
+ - !ruby/object:Gem::Version
118
+ version: '2.0'
119
+ type: :development
120
+ prerelease: false
121
+ version_requirements: !ruby/object:Gem::Requirement
122
+ requirements:
123
+ - - "~>"
124
+ - !ruby/object:Gem::Version
125
+ version: '2.0'
126
+ - !ruby/object:Gem::Dependency
127
+ name: bundler
128
+ requirement: !ruby/object:Gem::Requirement
129
+ requirements:
130
+ - - "~>"
131
+ - !ruby/object:Gem::Version
132
+ version: '1.10'
133
+ type: :development
134
+ prerelease: false
135
+ version_requirements: !ruby/object:Gem::Requirement
136
+ requirements:
137
+ - - "~>"
138
+ - !ruby/object:Gem::Version
139
+ version: '1.10'
140
+ - !ruby/object:Gem::Dependency
141
+ name: rake
142
+ requirement: !ruby/object:Gem::Requirement
143
+ requirements:
144
+ - - "~>"
145
+ - !ruby/object:Gem::Version
146
+ version: '10.0'
147
+ type: :development
148
+ prerelease: false
149
+ version_requirements: !ruby/object:Gem::Requirement
150
+ requirements:
151
+ - - "~>"
152
+ - !ruby/object:Gem::Version
153
+ version: '10.0'
154
+ - !ruby/object:Gem::Dependency
155
+ name: rspec
156
+ requirement: !ruby/object:Gem::Requirement
157
+ requirements:
158
+ - - "~>"
159
+ - !ruby/object:Gem::Version
160
+ version: '3.3'
161
+ type: :development
162
+ prerelease: false
163
+ version_requirements: !ruby/object:Gem::Requirement
164
+ requirements:
165
+ - - "~>"
166
+ - !ruby/object:Gem::Version
167
+ version: '3.3'
168
+ - !ruby/object:Gem::Dependency
169
+ name: rspec-its
170
+ requirement: !ruby/object:Gem::Requirement
171
+ requirements:
172
+ - - "~>"
173
+ - !ruby/object:Gem::Version
174
+ version: '1.0'
175
+ type: :development
176
+ prerelease: false
177
+ version_requirements: !ruby/object:Gem::Requirement
178
+ requirements:
179
+ - - "~>"
180
+ - !ruby/object:Gem::Version
181
+ version: '1.0'
182
+ - !ruby/object:Gem::Dependency
183
+ name: virtus-matchers
184
+ requirement: !ruby/object:Gem::Requirement
185
+ requirements:
186
+ - - ">="
187
+ - !ruby/object:Gem::Version
188
+ version: '0'
189
+ type: :development
190
+ prerelease: false
191
+ version_requirements: !ruby/object:Gem::Requirement
192
+ requirements:
193
+ - - ">="
194
+ - !ruby/object:Gem::Version
195
+ version: '0'
196
+ - !ruby/object:Gem::Dependency
197
+ name: shoulda-matchers
198
+ requirement: !ruby/object:Gem::Requirement
199
+ requirements:
200
+ - - ">="
201
+ - !ruby/object:Gem::Version
202
+ version: '0'
203
+ type: :development
204
+ prerelease: false
205
+ version_requirements: !ruby/object:Gem::Requirement
206
+ requirements:
207
+ - - ">="
208
+ - !ruby/object:Gem::Version
209
+ version: '0'
210
+ description: A Ruby Interface to the Yahoo Gemini API
211
+ email:
212
+ - ramon.tayag@gmail.com
213
+ - marcrendlignacio@gmail.com
214
+ executables: []
215
+ extensions: []
216
+ extra_rdoc_files: []
217
+ files:
218
+ - ".env"
219
+ - ".gitignore"
220
+ - ".rspec"
221
+ - ".ruby_version"
222
+ - ".travis.yml"
223
+ - CHANGELOG.md
224
+ - CODE_OF_CONDUCT.md
225
+ - Gemfile
226
+ - LICENSE.txt
227
+ - MIT-LICENSE.md
228
+ - README.md
229
+ - Rakefile
230
+ - bin/console
231
+ - bin/setup
232
+ - lib/yahoo_gemini_client.rb
233
+ - lib/yahoo_gemini_client/advertiser.rb
234
+ - lib/yahoo_gemini_client/advertisers.rb
235
+ - lib/yahoo_gemini_client/client.rb
236
+ - lib/yahoo_gemini_client/collection.rb
237
+ - lib/yahoo_gemini_client/generate_member_uri.rb
238
+ - lib/yahoo_gemini_client/requests/base_request.rb
239
+ - lib/yahoo_gemini_client/requests/custom_report_check_job_request.rb
240
+ - lib/yahoo_gemini_client/requests/custom_report_job_request.rb
241
+ - lib/yahoo_gemini_client/responses/base_response.rb
242
+ - lib/yahoo_gemini_client/responses/custom_report_response.rb
243
+ - lib/yahoo_gemini_client/services/custom_report.rb
244
+ - lib/yahoo_gemini_client/version.rb
245
+ - yahoo_gemini_client.gemspec
246
+ homepage: http://github.com/g5/yahoo_gemini_client
247
+ licenses:
248
+ - MIT
249
+ metadata:
250
+ allowed_push_host: https://rubygems.org
251
+ post_install_message:
252
+ rdoc_options: []
253
+ require_paths:
254
+ - lib
255
+ required_ruby_version: !ruby/object:Gem::Requirement
256
+ requirements:
257
+ - - ">="
258
+ - !ruby/object:Gem::Version
259
+ version: '0'
260
+ required_rubygems_version: !ruby/object:Gem::Requirement
261
+ requirements:
262
+ - - ">="
263
+ - !ruby/object:Gem::Version
264
+ version: '0'
265
+ requirements: []
266
+ rubyforge_project:
267
+ rubygems_version: 2.4.6
268
+ signing_key:
269
+ specification_version: 4
270
+ summary: A Ruby Interface to the Yahoo Gemini API
271
+ test_files: []