eucalyptus 0.3.3 → 1.0.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 4c606ad7853d05824ac3a9e9890da593b92ab59c
4
- data.tar.gz: 22c37ed3365f8734fa2c930be30a900778f9f94b
3
+ metadata.gz: 1d8b94c0e34c99c3e52dfc880ec2ab935714fd9d
4
+ data.tar.gz: f0b2b4a315a5f479295bc103099a62fe2af29e4c
5
5
  SHA512:
6
- metadata.gz: 18d5a12c975f389ac97e2b03bf9971d96c209900c7e535f78455bcb689bded63b994755bcac896efc239754ae6f492018083ae181538071c0bb81c91af9e843a
7
- data.tar.gz: 7a1caa4dda4b79646978da7caef4bbb42048236e6f3efaf6697a9ab88a62ce541f7d9fe9012a6a4287bac1247159207961a09616f658bb8018c20ade6ab53ae4
6
+ metadata.gz: 17fea8ae8d4bc46872ad0d1cac7f8f9d9b3818045c14d93bde5321ae08080e00ac470b453ac0a3470d1fb0dbdf1e3881c313dd1cc6c9eaf89497122cd7bed375
7
+ data.tar.gz: c26e0fdf4ab923e342bee7f3317a1240e33841fea9872dd903383c920e95c7e7d3789f12ab7083c6cd910573f57f9940b644c0d87762721b89ea58ea562a8fb0
data/README.md CHANGED
@@ -17,6 +17,7 @@ You then need to grab yourself an access token from facebook and initialize Euca
17
17
  ```
18
18
  Eucalyptus.configure do |config|
19
19
  config.access_token = YOUR_ACCESS_TOKEN
20
+ config.default_account_id = DEFAULT_ACCOUNT_ID
20
21
  end
21
22
  ```
22
23
 
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.3.3
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.3.3 ruby lib
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.3.3"
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-09-10"
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 = [
@@ -13,12 +13,11 @@ module Eucalyptus
13
13
  end
14
14
 
15
15
  def self.parent
16
- Account.all.last
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
@@ -1,11 +1,6 @@
1
1
  require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
2
2
 
3
3
  describe Eucalyptus::Ad 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(:ad) { Eucalyptus::Ad.all.last }
11
6
 
@@ -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.last
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
@@ -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.3.3
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-09-10 00:00:00.000000000 Z
11
+ date: 2015-10-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: koala