yandex_direct 0.1.0 → 0.2.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 +4 -4
- data/.rubocop.yml +4 -0
- data/.travis.yml +6 -0
- data/Gemfile +4 -1
- data/README.md +6 -1
- data/lib/yandex_direct.rb +2 -32
- data/lib/yandex_direct/geo_regions_item.rb +13 -0
- data/lib/yandex_direct/v5/api.rb +25 -0
- data/lib/yandex_direct/v5/dictionaries.rb +2 -2
- data/lib/yandex_direct/v5/request.rb +4 -1
- data/lib/yandex_direct/version.rb +1 -1
- data/yandex_direct.gemspec +1 -1
- metadata +5 -4
- data/lib/yandex_direct/v5/geo_regions_item.rb +0 -11
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 14b05d58fb32619a11756ddac6466ba4bafff4d35cb6fe3d451f62737829cbcc
|
4
|
+
data.tar.gz: 7fbfed575a3fb120c1997c7959f34442f504a21f2dc5e08f16e11acf693a47e4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b946381b1e6e8b6210635e810d4fbcb59aa85cd5254e1dd32856dd2b8655d3f1b8a843a55ba8ed0c3f82b9892b1fb760508d78f41c1b42444fc9b1eee2af6b3b
|
7
|
+
data.tar.gz: e004ee719582415003dd9b6c6afc00d16bea3c0259706c9e75f14adeb090a559f14957b32a71b192395399cdc557c326b98acd6c5dff9094afdd83b88fe23cba
|
data/.rubocop.yml
CHANGED
data/.travis.yml
CHANGED
@@ -3,3 +3,9 @@ language: ruby
|
|
3
3
|
rvm:
|
4
4
|
- 2.5.0
|
5
5
|
before_install: gem install bundler -v 1.16.1
|
6
|
+
before_script:
|
7
|
+
- curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter
|
8
|
+
- chmod +x ./cc-test-reporter
|
9
|
+
- ./cc-test-reporter before-build
|
10
|
+
after_script:
|
11
|
+
- ./cc-test-reporter after-build --exit-code $TRAVIS_TEST_RESULT
|
data/Gemfile
CHANGED
@@ -8,5 +8,8 @@ git_source(:github) { |repo_name| "https://github.com/#{repo_name}" }
|
|
8
8
|
gemspec
|
9
9
|
|
10
10
|
group :test do
|
11
|
-
gem '
|
11
|
+
gem 'rspec', '~> 3.7'
|
12
|
+
gem 'rubocop', '~> 0.54.0'
|
13
|
+
gem 'simplecov', '~> 0.16.1'
|
14
|
+
gem 'webmock', '~> 3.3'
|
12
15
|
end
|
data/README.md
CHANGED
@@ -1,4 +1,9 @@
|
|
1
|
-
#
|
1
|
+
# The Yandex.Direct Ruby Gem
|
2
|
+
|
3
|
+
[](https://badge.fury.io/rb/yandex_direct)
|
4
|
+
[](https://travis-ci.org/radanisk/yandex_direct)
|
5
|
+
[](https://codeclimate.com/github/radanisk/yandex_direct/maintainability)
|
6
|
+
[](https://codeclimate.com/github/radanisk/yandex_direct/test_coverage)
|
2
7
|
|
3
8
|
A Ruby interface to the Yandex Direct API.
|
4
9
|
|
data/lib/yandex_direct.rb
CHANGED
@@ -5,27 +5,13 @@ require 'yandex_direct/authorization_error'
|
|
5
5
|
require 'yandex_direct/error'
|
6
6
|
require 'yandex_direct/not_enough_units_error'
|
7
7
|
require 'yandex_direct/blank_data_error'
|
8
|
+
require 'yandex_direct/v5/api'
|
8
9
|
require 'yandex_direct/v5/request'
|
9
|
-
require 'yandex_direct/v5/ads'
|
10
|
-
require 'yandex_direct/v5/ad_groups'
|
11
|
-
require 'yandex_direct/v5/ad_images'
|
12
|
-
require 'yandex_direct/v5/campaigns'
|
13
|
-
require 'yandex_direct/v5/dictionaries'
|
14
|
-
require 'yandex_direct/v5/keywords'
|
15
|
-
require 'yandex_direct/v5/sitelinks'
|
16
|
-
require 'yandex_direct/v5/v_cards'
|
17
10
|
require 'yandex_direct/version'
|
18
11
|
|
19
12
|
module YandexDirect
|
20
13
|
class Client
|
21
|
-
include YandexDirect::V5::
|
22
|
-
include YandexDirect::V5::AdGroups
|
23
|
-
include YandexDirect::V5::AdImages
|
24
|
-
include YandexDirect::V5::Campaigns
|
25
|
-
include YandexDirect::V5::Dictionaries
|
26
|
-
include YandexDirect::V5::Keywords
|
27
|
-
include YandexDirect::V5::Sitelinks
|
28
|
-
include YandexDirect::V5::VCards
|
14
|
+
include YandexDirect::V5::API
|
29
15
|
|
30
16
|
attr_accessor :token, :login, :test, :app_id
|
31
17
|
attr_reader :available_units
|
@@ -77,12 +63,6 @@ module YandexDirect
|
|
77
63
|
request_live('GetBannersTags', param)
|
78
64
|
end
|
79
65
|
|
80
|
-
def regions
|
81
|
-
request('GetRegions')['data'].map do |region_data|
|
82
|
-
YandexDirect::RegionInfo.new(region_data)
|
83
|
-
end
|
84
|
-
end
|
85
|
-
|
86
66
|
def ping_api
|
87
67
|
request('PingAPI')
|
88
68
|
end
|
@@ -111,14 +91,4 @@ module YandexDirect
|
|
111
91
|
request_v4(@url_live, method, param)
|
112
92
|
end
|
113
93
|
end
|
114
|
-
|
115
|
-
class RegionInfo
|
116
|
-
attr_reader :region_id, :parent_id, :region_name
|
117
|
-
|
118
|
-
def initialize(attrs)
|
119
|
-
@region_id = attrs['RegionID']
|
120
|
-
@parent_id = attrs['ParentID']
|
121
|
-
@region_name = attrs['RegionName']
|
122
|
-
end
|
123
|
-
end
|
124
94
|
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module YandexDirect
|
4
|
+
class GeoRegionsItem
|
5
|
+
attr_reader :geo_region_id, :parent_id, :geo_region_name
|
6
|
+
|
7
|
+
def initialize(attrs)
|
8
|
+
@geo_region_id = attrs['GeoRegionId']
|
9
|
+
@parent_id = attrs['ParentId']
|
10
|
+
@geo_region_name = attrs['GeoRegionName']
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'yandex_direct/v5/ads'
|
4
|
+
require 'yandex_direct/v5/ad_groups'
|
5
|
+
require 'yandex_direct/v5/ad_images'
|
6
|
+
require 'yandex_direct/v5/campaigns'
|
7
|
+
require 'yandex_direct/v5/dictionaries'
|
8
|
+
require 'yandex_direct/v5/keywords'
|
9
|
+
require 'yandex_direct/v5/sitelinks'
|
10
|
+
require 'yandex_direct/v5/v_cards'
|
11
|
+
|
12
|
+
module YandexDirect
|
13
|
+
module V5
|
14
|
+
module API
|
15
|
+
include YandexDirect::V5::Ads
|
16
|
+
include YandexDirect::V5::AdGroups
|
17
|
+
include YandexDirect::V5::AdImages
|
18
|
+
include YandexDirect::V5::Campaigns
|
19
|
+
include YandexDirect::V5::Dictionaries
|
20
|
+
include YandexDirect::V5::Keywords
|
21
|
+
include YandexDirect::V5::Sitelinks
|
22
|
+
include YandexDirect::V5::VCards
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
@@ -1,6 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require 'yandex_direct/
|
3
|
+
require 'yandex_direct/geo_regions_item'
|
4
4
|
|
5
5
|
module YandexDirect
|
6
6
|
module V5
|
@@ -13,7 +13,7 @@ module YandexDirect
|
|
13
13
|
response = YandexDirect::V5::Request.new(self, @token, 'dictionaries', 'get', params).perform
|
14
14
|
if response[:result]['GeoRegions'].any?
|
15
15
|
response[:result]['GeoRegions'].map! do |region_data|
|
16
|
-
GeoRegionsItem.new(region_data)
|
16
|
+
YandexDirect::GeoRegionsItem.new(region_data)
|
17
17
|
end
|
18
18
|
end
|
19
19
|
response[:result]
|
@@ -3,9 +3,12 @@
|
|
3
3
|
module YandexDirect
|
4
4
|
module V5
|
5
5
|
class Request
|
6
|
+
BASE_URL = 'https://api.direct.yandex.com/json/v5/'
|
7
|
+
SANDBOX_BASE_URL = 'https://api-sandbox.direct.yandex.com/json/v5/'
|
8
|
+
|
6
9
|
def initialize(client, token, service_name, method, params)
|
7
10
|
@payload = { method: method, params: params }
|
8
|
-
api_url = client.test ?
|
11
|
+
api_url = client.test ? SANDBOX_BASE_URL : BASE_URL
|
9
12
|
@url = "#{api_url}#{service_name}"
|
10
13
|
@token = token
|
11
14
|
end
|
data/yandex_direct.gemspec
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: yandex_direct
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Aleksandr B. Ivanov
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-
|
11
|
+
date: 2018-04-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: http
|
@@ -87,13 +87,14 @@ files:
|
|
87
87
|
- lib/yandex_direct/authorization_error.rb
|
88
88
|
- lib/yandex_direct/blank_data_error.rb
|
89
89
|
- lib/yandex_direct/error.rb
|
90
|
+
- lib/yandex_direct/geo_regions_item.rb
|
90
91
|
- lib/yandex_direct/not_enough_units_error.rb
|
91
92
|
- lib/yandex_direct/v5/ad_groups.rb
|
92
93
|
- lib/yandex_direct/v5/ad_images.rb
|
93
94
|
- lib/yandex_direct/v5/ads.rb
|
95
|
+
- lib/yandex_direct/v5/api.rb
|
94
96
|
- lib/yandex_direct/v5/campaigns.rb
|
95
97
|
- lib/yandex_direct/v5/dictionaries.rb
|
96
|
-
- lib/yandex_direct/v5/geo_regions_item.rb
|
97
98
|
- lib/yandex_direct/v5/keywords.rb
|
98
99
|
- lib/yandex_direct/v5/request.rb
|
99
100
|
- lib/yandex_direct/v5/sitelinks.rb
|
@@ -120,7 +121,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
120
121
|
version: '0'
|
121
122
|
requirements: []
|
122
123
|
rubyforge_project:
|
123
|
-
rubygems_version: 2.7.
|
124
|
+
rubygems_version: 2.7.6
|
124
125
|
signing_key:
|
125
126
|
specification_version: 4
|
126
127
|
summary: A Ruby interface to the Yandex Direct API
|
@@ -1,11 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
class GeoRegionsItem
|
4
|
-
attr_reader :geo_region_id, :parent_id, :geo_region_name
|
5
|
-
|
6
|
-
def initialize(attrs)
|
7
|
-
@geo_region_id = attrs['GeoRegionId']
|
8
|
-
@parent_id = attrs['ParentId']
|
9
|
-
@geo_region_name = attrs['GeoRegionName']
|
10
|
-
end
|
11
|
-
end
|