three-sixty 0.0.8 → 0.0.9

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: c8bb8285370ea960ab4d6b2f43ba4a3d3fdb0aad
4
- data.tar.gz: df4ff45183e9adbd55306b037bbf7b5f0e9f1307
3
+ metadata.gz: 249e9939329744e7012a42acb0035ad05a09ee0c
4
+ data.tar.gz: 36127cabee883a90c097241dd65aa0cf27bb15e7
5
5
  SHA512:
6
- metadata.gz: 73348a8ebf55b9c6f58b9b55a192273a1fc9546e03b4ba5a1ae38ebb1e25e256b7df69ad11d2e16cfd7c53905397fdf175bc09e867fade72e3d6e1de6752ad02
7
- data.tar.gz: 5272e7069aa97df7dc8ee3d2d536af2a2b6c55081d5128da92d09f31bbb7827bc2ec79fe8cafb94d87aa0df876c5ecb1f8709305feaa4c2d5f6b3b3510b4b0e8
6
+ metadata.gz: f3bfcf513cb6aede86f1c0dc30271b5d97ae5b7d6e4e77de690f2a33d80769c48d4adb2208bb1da9ea85112d8687e21613d615eaafce5e8139550aec1d56cdda
7
+ data.tar.gz: bb09fce3963fe121905d235c2f7b93081443ece14e0bca8254618c8beda0ef5a60b7eee874445f55792318116fe404f01d01bf37f9690b50de0cd5c8cd2564e4
@@ -1,6 +1,9 @@
1
+ require_relative 'client'
2
+
1
3
  module ThreeSixty
2
4
  module Core
3
5
  class Account
6
+ include ThreeSixty::Core::Client
4
7
 
5
8
  SERVICE_URL = 'account'
6
9
 
@@ -9,27 +12,27 @@ module ThreeSixty
9
12
  end
10
13
 
11
14
  def client_login(username, password)
12
- @client.request(resource_url("clientLogin"), username: username, passwd: password)
15
+ client_request(@client, resource_url("clientLogin"), username: username, passwd: password)
13
16
  end
14
17
 
15
18
  def get_campaign_id_list
16
- @client.request(resource_url("getCampaignIdList"))
19
+ client_request(@client, resource_url("getCampaignIdList"))
17
20
  end
18
21
 
19
22
  def get_info
20
- @client.request(resource_url("getInfo"))
23
+ client_request(@client, resource_url("getInfo"))
21
24
  end
22
25
 
23
26
  def get_all_objects(campaign_ids)
24
- @client.request(resource_url("getAllObjects"), idList: campaign_ids)
27
+ client_request(@client, resource_url("getAllObjects"), idList: campaign_ids)
25
28
  end
26
29
 
27
30
  def get_file_state(file_id)
28
- @client.request(resource_url("getFileState"), fileId: file_id)
31
+ client_request(@client, resource_url("getFileState"), fileId: file_id)
29
32
  end
30
33
 
31
34
  def get_exclude_ip
32
- @client.request(resource_url("getExcludeIp"))
35
+ client_request(@client, resource_url("getExcludeIp"))
33
36
  end
34
37
 
35
38
  private
@@ -1,6 +1,9 @@
1
+ require_relative 'client'
2
+
1
3
  module ThreeSixty
2
4
  module Core
3
5
  class Campaign
6
+ include ThreeSixty::Core::Client
4
7
 
5
8
  SERVICE_URL = 'campaign'
6
9
 
@@ -9,11 +12,11 @@ module ThreeSixty
9
12
  end
10
13
 
11
14
  def get_info_by_id(campaign_id)
12
- @client.request(resource_url("getInfoById"), id: campaign_id)
15
+ client_request(@client, resource_url("getInfoById"), id: campaign_id)
13
16
  end
14
17
 
15
18
  def get_info_by_id_list(campaign_ids)
16
- @client.request(resource_url("getInfoByIdList"), idList: campaign_ids)
19
+ client_request(@client, resource_url("getInfoByIdList"), idList: campaign_ids)
17
20
  end
18
21
 
19
22
  private
@@ -0,0 +1,15 @@
1
+ module ThreeSixty
2
+ module Core
3
+ module Client
4
+
5
+ def client_request(client, url, params = {})
6
+ response = client.request(url, params)
7
+ raise ThreeSixtyResponseError.new("Invalid request: #{response['failures']}") if response.is_a?(Hash) && ! response['failures'].nil?
8
+ response
9
+ end
10
+
11
+ class ThreeSixtyResponseError < StandardError; end
12
+
13
+ end
14
+ end
15
+ end
@@ -1,6 +1,9 @@
1
+ require_relative 'client'
2
+
1
3
  module ThreeSixty
2
4
  module Core
3
5
  class Creative
6
+ include ThreeSixty::Core::Client
4
7
 
5
8
  SERVICE_URL = 'creative'
6
9
 
@@ -10,23 +13,23 @@ module ThreeSixty
10
13
 
11
14
  def get_id_list_by_group_id(ad_group_id, opts = {})
12
15
  opts.merge!(groupId: ad_group_id)
13
- @client.request(resource_url("getIdListByGroupId"), opts)
16
+ client_request(@client, resource_url("getIdListByGroupId"), opts)
14
17
  end
15
18
 
16
19
  def get_info_by_id(creative_id)
17
- @client.request(resource_url("getInfoById"), id: creative_id)
20
+ client_request(@client, resource_url("getInfoById"), id: creative_id)
18
21
  end
19
22
 
20
23
  def get_info_by_id_list(creative_ids)
21
- @client.request(resource_url("getInfoByIdList"), idList: creative_ids)
24
+ client_request(@client, resource_url("getInfoByIdList"), idList: creative_ids)
22
25
  end
23
26
 
24
27
  def get_status_by_id_list(creative_ids)
25
- @client.request(resource_url("getStatusByIdList"), idList: creative_ids)
28
+ client_request(@client, resource_url("getStatusByIdList"), idList: creative_ids)
26
29
  end
27
30
 
28
31
  def get_changed_id_list(from_time)
29
- @client.request(resource_url("getChangedIdList"), fromTime: from_time)
32
+ client_request(@client, resource_url("getChangedIdList"), fromTime: from_time)
30
33
  end
31
34
 
32
35
  private
@@ -1,6 +1,9 @@
1
+ require_relative 'client'
2
+
1
3
  module ThreeSixty
2
4
  module Core
3
5
  class Group
6
+ include ThreeSixty::Core::Client
4
7
 
5
8
  SERVICE_URL = 'group'
6
9
 
@@ -10,15 +13,15 @@ module ThreeSixty
10
13
 
11
14
  def get_id_list_by_campaign_id(campaign_id, opts = {})
12
15
  opts.merge!(campaignId: campaign_id)
13
- @client.request(resource_url("getIdListByCampaignId"), opts)
16
+ client_request(@client, resource_url("getIdListByCampaignId"), opts)
14
17
  end
15
18
 
16
19
  def get_info_by_id(adgroup_id)
17
- @client.request(resource_url("getInfoById"), id: adgroup_id)
20
+ client_request(@client, resource_url("getInfoById"), id: adgroup_id)
18
21
  end
19
22
 
20
23
  def get_info_by_id_list(adgroup_ids)
21
- @client.request(resource_url("getInfoByIdList"), idList: adgroup_ids)
24
+ client_request(@client, resource_url("getInfoByIdList"), idList: adgroup_ids)
22
25
  end
23
26
 
24
27
  private
@@ -1,6 +1,9 @@
1
+ require_relative 'client'
2
+
1
3
  module ThreeSixty
2
4
  module Core
3
5
  class Keyword
6
+ include ThreeSixty::Core::Client
4
7
 
5
8
  SERVICE_URL = 'keyword'
6
9
 
@@ -10,23 +13,23 @@ module ThreeSixty
10
13
 
11
14
  def get_id_list_by_group_id(ad_group_id, opts = {})
12
15
  opts.merge!(groupId: ad_group_id)
13
- @client.request(resource_url("getIdListByGroupId"), opts)
16
+ client_request(@client, resource_url("getIdListByGroupId"), opts)
14
17
  end
15
18
 
16
19
  def get_info_by_id(keyword_id)
17
- @client.request(resource_url("getInfoById"), id: keyword_id)
20
+ client_request(@client, resource_url("getInfoById"), id: keyword_id)
18
21
  end
19
22
 
20
23
  def get_status_by_id_list(keyword_ids)
21
- @client.request(resource_url("getStatusByIdList"), idList: keyword_ids)
24
+ client_request(@client, resource_url("getStatusByIdList"), idList: keyword_ids)
22
25
  end
23
26
 
24
27
  def get_info_by_id_list(keyword_ids)
25
- @client.request(resource_url("getInfoByIdList"), idList: keyword_ids)
28
+ client_request(@client, resource_url("getInfoByIdList"), idList: keyword_ids)
26
29
  end
27
30
 
28
31
  def get_changed_id_list(from_time)
29
- @client.request(resource_url("getChangedIdList"), fromTime: from_time)
32
+ client_request(@client, resource_url("getChangedIdList"), fromTime: from_time)
30
33
  end
31
34
 
32
35
  private
@@ -1,6 +1,9 @@
1
+ require_relative 'client'
2
+
1
3
  module ThreeSixty
2
4
  module Core
3
5
  class Report
6
+ include ThreeSixty::Core::Client
4
7
 
5
8
  SERVICE_URL = 'report'
6
9
 
@@ -10,32 +13,32 @@ module ThreeSixty
10
13
 
11
14
  def keyword_count(start_date, level, opts = {})
12
15
  opts.merge!({startDate: start_date, level: level})
13
- @client.request(resource_url("keywordCount"), opts)
16
+ client_request(@client, resource_url("keywordCount"), opts)
14
17
  end
15
18
 
16
19
  def keyword(start_date, level, opts = {})
17
20
  opts.merge!({startDate: start_date, level: level})
18
- @client.request(resource_url("keyword"), opts)
21
+ client_request(@client, resource_url("keyword"), opts)
19
22
  end
20
23
 
21
24
  def creative_count(start_date, level, opts = {})
22
25
  opts.merge!({startDate: start_date, level: level})
23
- @client.request(resource_url("creativeCount"), opts)
26
+ client_request(@client, resource_url("creativeCount"), opts)
24
27
  end
25
28
 
26
29
  def creative(start_date, level, opts = {})
27
30
  opts.merge!({startDate: start_date, level: level})
28
- @client.request(resource_url("creative"), opts)
31
+ client_request(@client, resource_url("creative"), opts)
29
32
  end
30
33
 
31
34
  def region_count(start_date, level, opts = {})
32
35
  opts.merge!({startDate: start_date, level: level})
33
- @client.request(resource_url("regionCount"), opts)
36
+ client_request(@client, resource_url("regionCount"), opts)
34
37
  end
35
38
 
36
39
  def region(start_date, level, opts = {})
37
40
  opts.merge!({startDate: start_date, level: level})
38
- @client.request(resource_url("region"), opts)
41
+ client_request(@client, resource_url("region"), opts)
39
42
  end
40
43
 
41
44
  private
@@ -1,3 +1,3 @@
1
1
  module ThreeSixty
2
- VERSION = "0.0.8"
2
+ VERSION = "0.0.9"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: three-sixty
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.8
4
+ version: 0.0.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Daniel Padden
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-08-04 00:00:00.000000000 Z
11
+ date: 2014-11-24 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: Connecting to the 360 api
14
14
  email:
@@ -17,7 +17,7 @@ executables: []
17
17
  extensions: []
18
18
  extra_rdoc_files: []
19
19
  files:
20
- - .gitignore
20
+ - ".gitignore"
21
21
  - README.md
22
22
  - lib/three-sixty.rb
23
23
  - lib/three-sixty/account.rb
@@ -26,6 +26,7 @@ files:
26
26
  - lib/three-sixty/configuration.rb
27
27
  - lib/three-sixty/core/account.rb
28
28
  - lib/three-sixty/core/campaign.rb
29
+ - lib/three-sixty/core/client.rb
29
30
  - lib/three-sixty/core/creative.rb
30
31
  - lib/three-sixty/core/group.rb
31
32
  - lib/three-sixty/core/keyword.rb
@@ -46,17 +47,17 @@ require_paths:
46
47
  - lib
47
48
  required_ruby_version: !ruby/object:Gem::Requirement
48
49
  requirements:
49
- - - '>='
50
+ - - ">="
50
51
  - !ruby/object:Gem::Version
51
52
  version: '0'
52
53
  required_rubygems_version: !ruby/object:Gem::Requirement
53
54
  requirements:
54
- - - '>='
55
+ - - ">="
55
56
  - !ruby/object:Gem::Version
56
57
  version: '0'
57
58
  requirements: []
58
59
  rubyforge_project:
59
- rubygems_version: 2.2.1
60
+ rubygems_version: 2.4.2
60
61
  signing_key:
61
62
  specification_version: 4
62
63
  summary: Gathering data from the 360 api