eucalyptus 0.3.3 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +1 -0
- data/VERSION +1 -1
- data/eucalyptus.gemspec +3 -3
- data/lib/eucalyptus/resource.rb +1 -2
- data/lib/eucalyptus.rb +7 -1
- data/spec/eucalyptus/account_spec.rb +0 -6
- data/spec/eucalyptus/ad_set_spec.rb +0 -6
- data/spec/eucalyptus/ad_spec.rb +0 -5
- data/spec/eucalyptus/campaign_spec.rb +0 -5
- data/spec/eucalyptus/custom_audience_spec.rb +1 -7
- data/spec/eucalyptus/insight_spec.rb +0 -6
- data/spec/eucalyptus/resource_spec.rb +0 -6
- data/spec/eucalyptus_spec.rb +6 -0
- data/spec/spec_helper.rb +6 -1
- 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: 1d8b94c0e34c99c3e52dfc880ec2ab935714fd9d
|
4
|
+
data.tar.gz: f0b2b4a315a5f479295bc103099a62fe2af29e4c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 17fea8ae8d4bc46872ad0d1cac7f8f9d9b3818045c14d93bde5321ae08080e00ac470b453ac0a3470d1fb0dbdf1e3881c313dd1cc6c9eaf89497122cd7bed375
|
7
|
+
data.tar.gz: c26e0fdf4ab923e342bee7f3317a1240e33841fea9872dd903383c920e95c7e7d3789f12ab7083c6cd910573f57f9940b644c0d87762721b89ea58ea562a8fb0
|
data/README.md
CHANGED
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.
|
1
|
+
1.0.0
|
data/eucalyptus.gemspec
CHANGED
@@ -2,16 +2,16 @@
|
|
2
2
|
# DO NOT EDIT THIS FILE DIRECTLY
|
3
3
|
# Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
|
4
4
|
# -*- encoding: utf-8 -*-
|
5
|
-
# stub: eucalyptus 0.
|
5
|
+
# stub: eucalyptus 1.0.0 ruby lib
|
6
6
|
|
7
7
|
Gem::Specification.new do |s|
|
8
8
|
s.name = "eucalyptus"
|
9
|
-
s.version = "0.
|
9
|
+
s.version = "1.0.0"
|
10
10
|
|
11
11
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
12
12
|
s.require_paths = ["lib"]
|
13
13
|
s.authors = ["Oguz Huner"]
|
14
|
-
s.date = "2015-
|
14
|
+
s.date = "2015-10-19"
|
15
15
|
s.description = "An easy interface and abstraction to the Facebook Ads API"
|
16
16
|
s.email = "oguzcanhuner@gmail.com"
|
17
17
|
s.extra_rdoc_files = [
|
data/lib/eucalyptus/resource.rb
CHANGED
@@ -13,12 +13,11 @@ module Eucalyptus
|
|
13
13
|
end
|
14
14
|
|
15
15
|
def self.parent
|
16
|
-
|
16
|
+
Eucalyptus.default_account
|
17
17
|
end
|
18
18
|
|
19
19
|
def self.find(id, fields: [], graph: Eucalyptus.graph)
|
20
20
|
fields.concat(self.known_fields).uniq
|
21
|
-
|
22
21
|
response = graph.get_object(id, fields: fields)
|
23
22
|
self.new(response)
|
24
23
|
end
|
data/lib/eucalyptus.rb
CHANGED
@@ -7,11 +7,17 @@ Koala.config.api_version = 'v2.3'
|
|
7
7
|
|
8
8
|
module Eucalyptus
|
9
9
|
class << self
|
10
|
-
attr_accessor :access_token, :graph
|
10
|
+
attr_accessor :access_token, :default_account_id, :graph
|
11
11
|
|
12
12
|
def configure
|
13
13
|
yield(self)
|
14
14
|
self.graph = Koala::Facebook::API.new(access_token)
|
15
|
+
self.default_account_id = default_account_id
|
16
|
+
end
|
17
|
+
|
18
|
+
def default_account
|
19
|
+
raise "Please provide a default account id" if self.default_account_id.nil?
|
20
|
+
@default_account ||= Eucalyptus::Account.find("act_#{self.default_account_id}")
|
15
21
|
end
|
16
22
|
end
|
17
23
|
end
|
@@ -1,12 +1,6 @@
|
|
1
1
|
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
|
2
2
|
|
3
3
|
describe Eucalyptus::Account do
|
4
|
-
before do
|
5
|
-
Eucalyptus.configure do |config|
|
6
|
-
config.access_token = ENV["ACCESS_TOKEN"]
|
7
|
-
end
|
8
|
-
end
|
9
|
-
|
10
4
|
let(:account) { Eucalyptus::Account.all.last }
|
11
5
|
|
12
6
|
describe '#insights' do
|
@@ -1,12 +1,6 @@
|
|
1
1
|
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
|
2
2
|
|
3
3
|
describe Eucalyptus::AdSet do
|
4
|
-
before do
|
5
|
-
Eucalyptus.configure do |config|
|
6
|
-
config.access_token = ENV["ACCESS_TOKEN"]
|
7
|
-
end
|
8
|
-
end
|
9
|
-
|
10
4
|
let(:ad_set) { Eucalyptus::AdSet.all.first }
|
11
5
|
|
12
6
|
describe '#insights' do
|
data/spec/eucalyptus/ad_spec.rb
CHANGED
@@ -1,11 +1,6 @@
|
|
1
1
|
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
|
2
2
|
|
3
3
|
describe Eucalyptus::Campaign do
|
4
|
-
before do
|
5
|
-
Eucalyptus.configure do |config|
|
6
|
-
config.access_token = ENV["ACCESS_TOKEN"]
|
7
|
-
end
|
8
|
-
end
|
9
4
|
|
10
5
|
let(:campaign) { Eucalyptus::Campaign.all.last }
|
11
6
|
|
@@ -1,12 +1,6 @@
|
|
1
1
|
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
|
2
2
|
|
3
3
|
describe Eucalyptus::CustomAudience do
|
4
|
-
before do
|
5
|
-
Eucalyptus.configure do |config|
|
6
|
-
config.access_token = ENV["ACCESS_TOKEN"]
|
7
|
-
end
|
8
|
-
end
|
9
|
-
|
10
4
|
describe '.create' do
|
11
5
|
it 'creats a new custom audience' do
|
12
6
|
VCR.use_cassette('create_audience') do
|
@@ -27,7 +21,7 @@ describe Eucalyptus::CustomAudience do
|
|
27
21
|
describe '#ad_sets' do
|
28
22
|
it 'returns ad_sets which belong to the audience' do
|
29
23
|
VCR.use_cassette('audience_ad_sets') do
|
30
|
-
audience = Eucalyptus::CustomAudience.all.
|
24
|
+
audience = Eucalyptus::CustomAudience.all.first
|
31
25
|
ad_sets = audience.ad_sets
|
32
26
|
expect(ad_sets.first.targeting.custom_audiences.first['id']).to eql audience.id
|
33
27
|
end
|
@@ -1,12 +1,6 @@
|
|
1
1
|
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
|
2
2
|
|
3
3
|
describe Eucalyptus::Insight do
|
4
|
-
before do
|
5
|
-
Eucalyptus.configure do |config|
|
6
|
-
config.access_token = ENV["ACCESS_TOKEN"]
|
7
|
-
end
|
8
|
-
end
|
9
|
-
|
10
4
|
describe '.known_fields' do
|
11
5
|
it 'returns an object which responds to available fields' do
|
12
6
|
VCR.use_cassette('account_insights') do
|
@@ -1,12 +1,6 @@
|
|
1
1
|
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
|
2
2
|
|
3
3
|
describe Eucalyptus::Resource do
|
4
|
-
before do
|
5
|
-
Eucalyptus.configure do |config|
|
6
|
-
config.access_token = ENV["ACCESS_TOKEN"]
|
7
|
-
end
|
8
|
-
end
|
9
|
-
|
10
4
|
context "given a class which inherits from Eucalyptus::Resource" do
|
11
5
|
|
12
6
|
describe ".find" do
|
data/spec/eucalyptus_spec.rb
CHANGED
@@ -3,10 +3,12 @@ require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
|
|
3
3
|
describe "Eucalyptus" do
|
4
4
|
describe ".configure" do
|
5
5
|
let(:access_token) { "123abc" }
|
6
|
+
let(:default_account_id) { "456ghb" }
|
6
7
|
|
7
8
|
before do
|
8
9
|
Eucalyptus.configure do |config|
|
9
10
|
config.access_token = access_token
|
11
|
+
config.default_account_id = default_account_id
|
10
12
|
end
|
11
13
|
end
|
12
14
|
|
@@ -14,6 +16,10 @@ describe "Eucalyptus" do
|
|
14
16
|
graph = Eucalyptus.graph
|
15
17
|
expect(graph.access_token).to eql access_token
|
16
18
|
end
|
19
|
+
|
20
|
+
it 'returns a default account object' do
|
21
|
+
#Eucalyptus.default_account
|
22
|
+
end
|
17
23
|
end
|
18
24
|
|
19
25
|
end
|
data/spec/spec_helper.rb
CHANGED
@@ -22,5 +22,10 @@ end
|
|
22
22
|
Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each {|f| require f}
|
23
23
|
|
24
24
|
RSpec.configure do |config|
|
25
|
-
|
25
|
+
config.before do
|
26
|
+
Eucalyptus.configure do |config|
|
27
|
+
config.access_token = ENV["ACCESS_TOKEN"]
|
28
|
+
config.default_account_id = ENV["DEFAULT_ACCOUNT_ID"]
|
29
|
+
end
|
30
|
+
end
|
26
31
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: eucalyptus
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 1.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Oguz Huner
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-10-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: koala
|