ya-api-direct 0.2.0 → 0.2.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: ce703501aca78c8a889a4882c95500b2bb419c30
4
- data.tar.gz: 2b2be4b799ae9a28908fd44a362635f76e7cd99d
3
+ metadata.gz: 55bee9a56313eefa9d774f6edc2422328da00766
4
+ data.tar.gz: 1fb1aa4fe1bee7e0693ada9645a45014ec340488
5
5
  SHA512:
6
- metadata.gz: 70218a0c73fc096cbee98e6ad145739338cf52e1f6e94143bb8c263f950a8ac781dcef3fdfff1350c57d2e1bb5642cd0c51c8f1df54331efb6875bb1f728fa02
7
- data.tar.gz: 7431e2c5e3428697130ad840001c05157813035e4b09465e27ae015f1023ddf5ca069dcbed26e46fec02ccb631ec91757c0f3fd69b6a9412937dc06de6733a63
6
+ metadata.gz: 52caccd119c78cc82c6c291403426965a365dbc0444839e7ef1c0423ec604097c6253b9c6297140543d8f3102cd7b34282c53ff30aad691d3b33d35dfb45de35
7
+ data.tar.gz: 29faa276241e4cf1fb55b612ce78283a38b70ac5a7fb9a897ef50a174a9a12a0254d79d11436ac264e8b60d94f358a41441c49ad77a09a5fb16dd9e1e8f09fd6
data/.gitignore ADDED
@@ -0,0 +1,55 @@
1
+ *.gem
2
+ *.rbc
3
+ /.config
4
+ /coverage/
5
+ /InstalledFiles
6
+ /pkg/
7
+ /spec/reports/
8
+ /spec/examples.txt
9
+ /test/tmp/
10
+ /test/version_tmp/
11
+ /tmp/
12
+
13
+ # Used by dotenv library to load environment variables.
14
+ # .env
15
+
16
+ ## Specific to RubyMotion:
17
+ .dat*
18
+ .repl_history
19
+ build/
20
+ *.bridgesupport
21
+ build-iPhoneOS/
22
+ build-iPhoneSimulator/
23
+
24
+ ## Specific to RubyMotion (use of CocoaPods):
25
+ #
26
+ # We recommend against adding the Pods directory to your .gitignore. However
27
+ # you should judge for yourself, the pros and cons are mentioned at:
28
+ # https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control
29
+ #
30
+ # vendor/Pods/
31
+
32
+ ## Documentation cache and generated files:
33
+ /.yardoc/
34
+ /_yardoc/
35
+ /doc/
36
+ /rdoc/
37
+
38
+ ## Environment normalization:
39
+ /.bundle/
40
+ /vendor/bundle
41
+ /lib/bundler/man/
42
+
43
+ # for a library or gem, you might want to ignore these files since the code is
44
+ # intended to run in multiple environments; otherwise, check them in:
45
+ # Gemfile.lock
46
+ # .ruby-version
47
+ # .ruby-gemset
48
+
49
+ # unless supporting rvm < 1.11.0 or doing something fancy, ignore this:
50
+ .rvmrc
51
+
52
+ Gemfile.lock
53
+
54
+ # for Mac
55
+ .DS_Store
data/.rspec ADDED
@@ -0,0 +1,2 @@
1
+ --color
2
+ --order random
data/.travis.yml ADDED
@@ -0,0 +1,5 @@
1
+ sudo: false
2
+ language: ruby
3
+ rvm:
4
+ - 2.0.0
5
+ before_install: gem install bundler -v 1.12.5
@@ -0,0 +1,49 @@
1
+ # Contributor Code of Conduct
2
+
3
+ As contributors and maintainers of this project, and in the interest of
4
+ fostering an open and welcoming community, we pledge to respect all people who
5
+ contribute through reporting issues, posting feature requests, updating
6
+ documentation, submitting pull requests or patches, and other activities.
7
+
8
+ We are committed to making participation in this project a harassment-free
9
+ experience for everyone, regardless of level of experience, gender, gender
10
+ identity and expression, sexual orientation, disability, personal appearance,
11
+ body size, race, ethnicity, age, religion, or nationality.
12
+
13
+ Examples of unacceptable behavior by participants include:
14
+
15
+ * The use of sexualized language or imagery
16
+ * Personal attacks
17
+ * Trolling or insulting/derogatory comments
18
+ * Public or private harassment
19
+ * Publishing other's private information, such as physical or electronic
20
+ addresses, without explicit permission
21
+ * Other unethical or unprofessional conduct
22
+
23
+ Project maintainers have the right and responsibility to remove, edit, or
24
+ reject comments, commits, code, wiki edits, issues, and other contributions
25
+ that are not aligned to this Code of Conduct, or to ban temporarily or
26
+ permanently any contributor for other behaviors that they deem inappropriate,
27
+ threatening, offensive, or harmful.
28
+
29
+ By adopting this Code of Conduct, project maintainers commit themselves to
30
+ fairly and consistently applying these principles to every aspect of managing
31
+ this project. Project maintainers who do not follow or enforce the Code of
32
+ Conduct may be permanently removed from the project team.
33
+
34
+ This code of conduct applies both within project spaces and in public spaces
35
+ when an individual is representing the project or its community.
36
+
37
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be
38
+ reported by contacting a project maintainer at TODO: Write your email address. All
39
+ complaints will be reviewed and investigated and will result in a response that
40
+ is deemed necessary and appropriate to the circumstances. Maintainers are
41
+ obligated to maintain confidentiality with regard to the reporter of an
42
+ incident.
43
+
44
+ This Code of Conduct is adapted from the [Contributor Covenant][homepage],
45
+ version 1.3.0, available at
46
+ [http://contributor-covenant.org/version/1/3/0/][version]
47
+
48
+ [homepage]: http://contributor-covenant.org
49
+ [version]: http://contributor-covenant.org/version/1/3/0/
data/Gemfile ADDED
@@ -0,0 +1,18 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gem 'jruby-openssl', platforms: :jruby
4
+ gem 'rake'
5
+ gem 'yard'
6
+
7
+ group :development do
8
+ # reserved
9
+ end
10
+
11
+ group :test do
12
+ gem 'rspec', '>= 2.14'
13
+ gem 'rubocop', '>= 0.37'
14
+ gem 'webmock'
15
+ gem 'yardstick'
16
+ end
17
+
18
+ gemspec
data/README.md CHANGED
@@ -1,11 +1,15 @@
1
- # ya-api-direct
2
- A Ruby interface to Yandex Direct API
1
+ # Ya::Api::Direct
2
+ A Ruby interface to Yandex Direct API. Supported versions 4, 4 Live, 5.
3
+
4
+ Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/ya/api/direct`. To experiment with that code, run `bin/console` for an interactive prompt.
3
5
 
4
6
  ## Installation
5
7
 
6
8
  Add this line to your application's Gemfile:
7
9
 
8
- gem 'ya-api-direct'
10
+ ```ruby
11
+ gem 'ya-api-direct'
12
+ ```
9
13
 
10
14
  And then execute:
11
15
 
@@ -13,11 +17,7 @@ And then execute:
13
17
 
14
18
  Or install it yourself as:
15
19
 
16
- $ gem install ya_direct_api
17
-
18
- Test with rake:
19
-
20
- $ rake
20
+ $ gem install ya-api-direct
21
21
 
22
22
  ## Usage
23
23
 
@@ -34,7 +34,8 @@ request = {
34
34
  "TextCampaignFieldNames" => ["BiddingStrategy"]
35
35
  }
36
36
 
37
- @direct = Ya::API::Direct::Client.new({ token: Token })
37
+ options = { token: Token }
38
+ @direct = Ya::API::Direct::Client.new(options)
38
39
  json = direct.campaigns.get request
39
40
  ```
40
41
 
@@ -47,6 +48,16 @@ json = direct.v4.GetCampaignsList []
47
48
 
48
49
  All names of controllers and methods are equal to ones from Direct API help. 4 vs 4 Live is autodetected.
49
50
 
51
+ Allowed options:
52
+ * ``token:`` Yandex Direct API token. Required field.
53
+ * ``app_id:`` Application ID. Isn't required. Used for Yandex stat.
54
+ * ``login:`` Application login. Isn't required. Used for Yandex stat.
55
+ * ``locale:`` One of locales, supported by Yandex API ('en' or 'ru'). By default: 'en'.
56
+ * ``mode:`` Yandex Direct API server to send requests (``:sandbox`` or ``production``). By default: ``:sandbox``.
57
+ * ``cache:`` send caching request after creating the instance. By default: ``true``.
58
+ * ``api:`` used only to make caching request (:v5 or :v4), By default: ``:v5``.
59
+ * ``ssl:`` use SSL connection. By default: ``true``.
60
+
50
61
  ## Caching
51
62
 
52
63
  By default the client class sends request to clients. You can avoid it by turning this option off, like this:
@@ -73,10 +84,16 @@ Units data of last request is stored in ``units_data`` property. There're 3 keys
73
84
  * [Yandex Direct API 5 manual](https://tech.yandex.ru/direct/doc/dg/concepts/about-docpage/)
74
85
  * [Yandex Direct API 4 and 4 Live manual](https://tech.yandex.ru/direct/doc/dg-v4/concepts/About-docpage/)
75
86
 
87
+ ## Development
88
+
89
+ After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake test` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
90
+
91
+ 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).
92
+
76
93
  ## Contributing
77
94
 
78
- 1. Fork it ( http://github.com/rikkimongoose/ya-api-direct/fork )
79
- 2. Create your feature branch (`git checkout -b my-new-feature`)
80
- 3. Commit your changes (`git commit -am 'Add some feature'`)
81
- 4. Push to the branch (`git push origin my-new-feature`)
82
- 5. Create new Pull Request
95
+ Bug reports and pull requests are welcome on GitHub at https://github.com/rikkimongoose/ya-api-direct. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
96
+
97
+ ## License
98
+
99
+ The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
data/Rakefile ADDED
@@ -0,0 +1,8 @@
1
+ require "bundler/gem_tasks"
2
+ require "rake/testtask"
3
+
4
+ task :spec do
5
+ Dir.glob('./spec/spec_*.rb').each { |file| require file}
6
+ end
7
+
8
+ task default: [:spec]
data/bin/console ADDED
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "ya/api/direct"
5
+
6
+ # You can add fixtures and/or initialization code here to make experimenting
7
+ # with your gem easier. You can also use a different console, if you like.
8
+
9
+ # (If you use this, don't forget to add pry to your Gemfile!)
10
+ # require "pry"
11
+ # Pry.start
12
+
13
+ require "irb"
14
+ IRB.start
data/bin/setup ADDED
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+ set -vx
5
+
6
+ bundle install
7
+
8
+ # Do any other automated setup that you need to do here
@@ -0,0 +1,3 @@
1
+ require "ya/api/direct/version"
2
+ require "ya/api/direct/client"
3
+ require "ya/api/direct/exception"
@@ -1,49 +1,7 @@
1
1
  module Ya
2
- module API
2
+ module Api
3
3
  module Direct
4
- module Version
5
- module_function
6
-
7
- # @return [Integer]
8
- def major
9
- 0
10
- end
11
-
12
- # @return [Integer]
13
- def minor
14
- 2
15
- end
16
-
17
- # @return [Integer]
18
- def patch
19
- 0
20
- end
21
-
22
- # @return [Integer, NilClass]
23
- def pre
24
- nil
25
- end
26
-
27
- # @return [Hash]
28
- def to_h
29
- {
30
- major: major,
31
- minor: minor,
32
- patch: patch,
33
- pre: pre,
34
- }
35
- end
36
-
37
- # @return [Array]
38
- def to_a
39
- [major, minor, patch, pre].compact
40
- end
41
-
42
- # @return [String]
43
- def to_s
44
- to_a.join('.')
45
- end
46
- end
4
+ VERSION = "0.2.1"
47
5
  end
48
6
  end
49
7
  end
@@ -1,18 +1,25 @@
1
1
  # coding: utf-8
2
- $:.push File.expand_path("../lib", __FILE__)
3
-
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
4
  require 'ya/api/direct/version'
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = 'ya-api-direct'
8
- s.version = '0.0.1'
8
+ s.version = Ya::Api::Direct::VERSION
9
9
  s.date = '2016-09-05'
10
10
  s.summary = "Yandex Direct API v5"
11
11
  s.description = "Ruby implementation for Yandex Direct API of versions 5, 4 and 4 Live"
12
- s.authors = %w("Alexander Teut")
12
+ s.authors = %w("Rikki Mongoose")
13
13
  s.email = 'alexander.a.teut@gmail.com'
14
- s.files = %w(LICENSE README.md ya-api-direct.gemspec) + Dir['lib/ya/api/direct/*.rb']
15
14
  s.homepage = 'http://rubygems.org/gems/ya-api-direct'
16
15
  s.license = 'MIT'
17
- s.version = Ya::API::Direct::Version
16
+
17
+ s.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
18
+ s.bindir = "exe"
19
+ s.executables = s.files.grep(%r{^exe/}) { |f| File.basename(f) }
20
+ s.require_paths = ["lib"]
21
+
22
+ s.add_development_dependency "bundler", "~> 1.12"
23
+ s.add_development_dependency "rake", "~> 10.0"
24
+ s.add_development_dependency "minitest", "~> 5.0"
18
25
  end
metadata CHANGED
@@ -1,25 +1,75 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ya-api-direct
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.1
5
5
  platform: ruby
6
6
  authors:
7
- - '"Alexander'
8
- - Teut"
7
+ - '"Rikki'
8
+ - Mongoose"
9
9
  autorequire:
10
- bindir: bin
10
+ bindir: exe
11
11
  cert_chain: []
12
12
  date: 2016-09-05 00:00:00.000000000 Z
13
- dependencies: []
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: bundler
16
+ requirement: !ruby/object:Gem::Requirement
17
+ requirements:
18
+ - - ~>
19
+ - !ruby/object:Gem::Version
20
+ version: '1.12'
21
+ type: :development
22
+ prerelease: false
23
+ version_requirements: !ruby/object:Gem::Requirement
24
+ requirements:
25
+ - - ~>
26
+ - !ruby/object:Gem::Version
27
+ version: '1.12'
28
+ - !ruby/object:Gem::Dependency
29
+ name: rake
30
+ requirement: !ruby/object:Gem::Requirement
31
+ requirements:
32
+ - - ~>
33
+ - !ruby/object:Gem::Version
34
+ version: '10.0'
35
+ type: :development
36
+ prerelease: false
37
+ version_requirements: !ruby/object:Gem::Requirement
38
+ requirements:
39
+ - - ~>
40
+ - !ruby/object:Gem::Version
41
+ version: '10.0'
42
+ - !ruby/object:Gem::Dependency
43
+ name: minitest
44
+ requirement: !ruby/object:Gem::Requirement
45
+ requirements:
46
+ - - ~>
47
+ - !ruby/object:Gem::Version
48
+ version: '5.0'
49
+ type: :development
50
+ prerelease: false
51
+ version_requirements: !ruby/object:Gem::Requirement
52
+ requirements:
53
+ - - ~>
54
+ - !ruby/object:Gem::Version
55
+ version: '5.0'
14
56
  description: Ruby implementation for Yandex Direct API of versions 5, 4 and 4 Live
15
57
  email: alexander.a.teut@gmail.com
16
58
  executables: []
17
59
  extensions: []
18
60
  extra_rdoc_files: []
19
61
  files:
62
+ - .gitignore
63
+ - .rspec
64
+ - .travis.yml
65
+ - CODE_OF_CONDUCT.md
66
+ - Gemfile
20
67
  - LICENSE
21
68
  - README.md
22
- - ya-api-direct.gemspec
69
+ - Rakefile
70
+ - bin/console
71
+ - bin/setup
72
+ - lib/ya/api/direct.rb
23
73
  - lib/ya/api/direct/client.rb
24
74
  - lib/ya/api/direct/constants.rb
25
75
  - lib/ya/api/direct/direct_service_base.rb
@@ -29,6 +79,7 @@ files:
29
79
  - lib/ya/api/direct/gateway.rb
30
80
  - lib/ya/api/direct/url_helper.rb
31
81
  - lib/ya/api/direct/version.rb
82
+ - ya-api-direct.gemspec
32
83
  homepage: http://rubygems.org/gems/ya-api-direct
33
84
  licenses:
34
85
  - MIT