yandex_client 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 2880e2f2d5736258497e2aaf7adfe617d7bc9a1ae1ff19770e0b88c362854469
4
+ data.tar.gz: 98ca385691189448b73a840cb5d0cecf4b8deb4e6042e4121f68c76e047d53a0
5
+ SHA512:
6
+ metadata.gz: e2a248d79d823659fb906fa873b64e2a78b130b861f5b6cf8b04fa80e3e080d7587b5593816784b0f390e793bd8776c8cc8aaf535f8f0d307d2e471fcf5c9890
7
+ data.tar.gz: 577d0b26cab47f90bf1b56e3b3107e79954cb4c80f57770c571e4360fe073f90494360983cadf6db9ac299cbc2a51f1c4421d72ec2c7cd36d29a5722661d3800
data/.gitignore ADDED
@@ -0,0 +1,16 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /_yardoc/
4
+ /coverage/
5
+ /doc/
6
+ /pkg/
7
+ /spec/reports/
8
+ /tmp/
9
+ /log/*
10
+
11
+ # rspec failure tracking
12
+ .rspec_status
13
+ .idea
14
+ .byebug_history
15
+
16
+ Gemfile.lock
data/.rspec ADDED
@@ -0,0 +1,6 @@
1
+ --color
2
+ --tty
3
+ --format progress
4
+ --order random
5
+ --backtrace
6
+ --require spec_helper
data/.travis.yml ADDED
@@ -0,0 +1,12 @@
1
+ sudo: false
2
+ language: ruby
3
+ rvm:
4
+ - 2.6.3
5
+ before_install: gem install bundler
6
+ before_script:
7
+ - bundle install
8
+ script: bundle exec rspec
9
+ notifications:
10
+ email:
11
+ on_success: never
12
+ on_failure: always
data/Gemfile ADDED
@@ -0,0 +1,8 @@
1
+ source "https://rubygems.org"
2
+
3
+ git_source(:github) {|repo_name| "https://github.com/#{repo_name}" }
4
+
5
+ gem 'pry-byebug'
6
+
7
+ # Specify your gem's dependencies in yandex_client.gemspec
8
+ gemspec
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2019 Maxim Tretyakov
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,114 @@
1
+ [![Build Status](https://travis-ci.org/yamax2/yandex_client.svg?branch=master)](https://travis-ci.org/yamax2/yandex_client)
2
+
3
+ # YandexClient
4
+
5
+ ## Installation
6
+
7
+ Add this line to your application's Gemfile:
8
+
9
+ ```ruby
10
+ gem 'yandex_client'
11
+ ```
12
+
13
+ And then execute:
14
+
15
+ $ bundle
16
+
17
+ Or install it yourself as:
18
+
19
+ $ gem install yandex_client
20
+
21
+ ## Usage
22
+
23
+ ### [Auth](https://yandex.ru/dev/oauth/doc/dg/concepts/about-docpage/)
24
+ ```ruby
25
+ cli = YandexClient::Auth::Client.new
26
+ ```
27
+
28
+ [create_token](https://tech.yandex.ru/oauth/doc/dg/reference/auto-code-client-docpage/#auto-code-client__get-token)
29
+ ```ruby
30
+ cli.create_token(code: 'your_code')
31
+ ```
32
+
33
+ [refresh_token](https://yandex.ru/dev/oauth/doc/dg/reference/refresh-client-docpage/)
34
+ ```ruby
35
+ cli.refresh_token(refresh_token: 'your_token')
36
+ ```
37
+
38
+ ### [Passport](https://tech.yandex.ru/passport/doc/dg/reference/)
39
+ ```ruby
40
+ cli = YandexClient::Passport::Client.new(access_token: 'your_access_token')
41
+ ```
42
+
43
+ [info](https://yandex.ru/dev/passport/doc/dg/reference/request-docpage/)
44
+ ```ruby
45
+ cli.info
46
+ ```
47
+
48
+ ### [Yandex Disk WebDav](https://yandex.ru/dev/disk/doc/dg/concepts/quickstart-docpage/)
49
+ ```ruby
50
+ cli = YandexClient::Dav::Client.new(access_token: 'your_token')
51
+ ```
52
+
53
+ [put](https://yandex.ru/dev/disk/doc/dg/reference/put-docpage/)
54
+ ```ruby
55
+ cli.put(file: '1.txt', name: '/a/b/c/1.txt')
56
+ ```
57
+
58
+ [delete](https://yandex.ru/dev/disk/doc/dg/reference/delete-docpage/)
59
+ ```ruby
60
+ cli.delete(name: '/a/b/c/1.txt')
61
+ ```
62
+
63
+ [mkcol](https://yandex.ru/dev/disk/doc/dg/reference/mkcol-docpage/)
64
+ ```ruby
65
+ cli.mkcol(name: '/a/b/c')
66
+ ```
67
+
68
+ [file props](https://yandex.ru/dev/disk/doc/dg/reference/property-request-docpage/)
69
+ ```ruby
70
+ cli.propfind(name: '/a/dip.yml', depth: 0)
71
+ ```
72
+
73
+ [list files in dir](https://yandex.ru/dev/disk/doc/dg/reference/property-request-docpage/)
74
+ ```ruby
75
+ cli.propfind(name: '/a', depth: 1)
76
+ ```
77
+
78
+ [account free space and quota](https://yandex.ru/dev/disk/doc/dg/reference/property-request-docpage/)
79
+ ```ruby
80
+ cli.propfind(name: '/', quota: true)
81
+ ```
82
+
83
+ ## Development
84
+
85
+ After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
86
+
87
+ 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).
88
+
89
+ ## Development with docker
90
+
91
+ * Install docker and docker-compose
92
+ * Install [dip](https://github.com/bibendi/dip)
93
+ ```hash
94
+ gem install dip
95
+ ```
96
+ * Prepare the the test environment
97
+ ```bash
98
+ dip provision
99
+ ```
100
+ * Run tests
101
+ ```bash
102
+ dip rspec
103
+ ```
104
+
105
+ ## TODO
106
+ * docs...
107
+
108
+ ## Contributing
109
+
110
+ Bug reports and pull requests are welcome on GitHub at https://github.com/yamax2/yandex_client.
111
+
112
+ ## License
113
+
114
+ The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
data/Rakefile ADDED
@@ -0,0 +1,6 @@
1
+ require "bundler/gem_tasks"
2
+ require "rspec/core/rake_task"
3
+
4
+ RSpec::Core::RakeTask.new(:spec)
5
+
6
+ task :default => :spec
data/bin/console ADDED
@@ -0,0 +1,6 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'bundler/setup'
4
+ require 'yandex_client'
5
+
6
+ Pry.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
data/dip.yml ADDED
@@ -0,0 +1,42 @@
1
+ version: '1'
2
+
3
+ environment:
4
+ DOCKER_RUBY_VERSION: 2.6
5
+ RUBY_IMAGE_TAG: 2.6.3
6
+ COMPOSE_FILE_EXT: development
7
+
8
+ compose:
9
+ files:
10
+ - docker/docker-compose.yml
11
+ - docker/docker-compose.${COMPOSE_FILE_EXT}.yml
12
+ project_name: yandex_client
13
+
14
+ interaction:
15
+ sh:
16
+ service: app
17
+
18
+ irb:
19
+ service: app
20
+ command: irb
21
+
22
+ bundle:
23
+ service: app
24
+ command: bundle
25
+
26
+ rake:
27
+ service: app
28
+ command: bundle exec rake
29
+
30
+ rspec:
31
+ service: app
32
+ command: bundle exec rspec
33
+
34
+ clean:
35
+ service: app
36
+ command: rm -f Gemfile.lock
37
+
38
+ provision:
39
+ - docker volume create --name bundler_data
40
+ - dip clean
41
+ - dip bundle install
42
+ - dip appraisal install
@@ -0,0 +1,9 @@
1
+ FROM ruby:2.6.3
2
+
3
+ RUN ln -fs /usr/share/zoneinfo/Asia/Yekaterinburg /etc/localtime \
4
+ && dpkg-reconfigure -f noninteractive tzdata
5
+
6
+ RUN echo 'gem: --no-rdoc --no-ri --no-document' > /root/.gemrc
7
+ RUN gem install bundler
8
+
9
+ WORKDIR /app
@@ -0,0 +1,18 @@
1
+ version: '2'
2
+
3
+ services:
4
+ app:
5
+ volumes:
6
+ - ..:/app
7
+ - ../:/localgems
8
+ - ssh-data:/ssh:ro
9
+ - bundler-data:/bundle
10
+
11
+ volumes:
12
+ bundler-data:
13
+ external:
14
+ name: bundler_data
15
+
16
+ ssh-data:
17
+ external:
18
+ name: ssh_data
@@ -0,0 +1,14 @@
1
+ version: '2'
2
+
3
+ services:
4
+ app:
5
+ build:
6
+ context: ../
7
+ dockerfile: ./docker/Dockerfile.${DOCKER_RUBY_VERSION}
8
+ environment:
9
+ - BUNDLE_PATH=/bundle/$DOCKER_RUBY_VERSION
10
+ - SSH_AUTH_SOCK=/ssh/auth/sock
11
+ - TEST_DB_HOST=db
12
+ - TEST_DB_NAME=docker
13
+ - TEST_DB_USERNAME=postgres
14
+ command: bash
@@ -0,0 +1,13 @@
1
+ module YandexClient
2
+ class ApiRequestError < StandardError
3
+ attr_reader :error, :error_description, :code
4
+
5
+ def initialize(error:, error_description:, code:)
6
+ @error = error
7
+ @error_description = error_description
8
+ @code = code
9
+
10
+ super [error, error_description, "http code #{@code}"].compact.join(', ')
11
+ end
12
+ end
13
+ end
@@ -0,0 +1,55 @@
1
+ require 'uri'
2
+
3
+ module YandexClient
4
+ module Auth
5
+ # https://tech.yandex.ru/oauth/doc/dg/reference/refresh-client-docpage/
6
+ # https://tech.yandex.ru/oauth/doc/dg/reference/auto-code-client-docpage/#auto-code-client__get-token
7
+ #
8
+ # https://oauth.yandex.ru/authorize?response_type=code&client_id=99bcbd17ad7f411694710592d978a4a2&force_confirm=false
9
+ #
10
+ # Example:
11
+ # token = Token.first
12
+ #
13
+ # client = YandexClient::Auth::Client.new
14
+ # client.create_token(code: '9388894')
15
+ # client.refresh_token(refresh_token: token.refresh_token)
16
+ class Client < ::YandexClient::Client
17
+ AUTH_ACTION_URL = 'https://oauth.yandex.ru/token'.freeze
18
+
19
+ ACTIONS = {
20
+ create_token: 'authorization_code',
21
+ refresh_token: 'refresh_token'
22
+ }.freeze
23
+
24
+ private
25
+
26
+ def http(_request_uri)
27
+ @http ||= super
28
+ end
29
+
30
+ def http_method_for_action
31
+ METHOD_POST
32
+ end
33
+
34
+ def request_body(params)
35
+ body_hash = {
36
+ grant_type: ACTIONS.fetch(@action),
37
+ client_id: ::YandexClient.config.api_key,
38
+ client_secret: ::YandexClient.config.api_secret
39
+ }.merge!(params)
40
+
41
+ URI.encode_www_form(body_hash)
42
+ end
43
+
44
+ def request_headers(_params)
45
+ {
46
+ 'Content-type' => 'application/x-www-form-urlencoded'
47
+ }
48
+ end
49
+
50
+ def request_uri(_params)
51
+ @request_uri ||= URI.parse(AUTH_ACTION_URL)
52
+ end
53
+ end
54
+ end
55
+ end
@@ -0,0 +1,97 @@
1
+ require 'oj'
2
+ require 'net/http'
3
+
4
+ module YandexClient
5
+ # Base api client
6
+ class Client
7
+ TIMEOUT = 10
8
+ METHOD_GET = 'Get'.freeze
9
+ METHOD_POST = 'Post'.freeze
10
+
11
+ ERRORS_BY_CODES = {
12
+ 404 => NotFoundError
13
+ }.freeze
14
+
15
+ def method_missing(method_name, *args, &_)
16
+ return super unless self.class::ACTIONS.include?(method_name)
17
+
18
+ @action = method_name
19
+ result = nil
20
+ response = make_request(args.last.is_a?(Hash) ? args.last : {})
21
+
22
+ result = parse_response_body(response) unless response.body.nil? || response.body.empty?
23
+ process_errors(response, result) unless response.is_a?(Net::HTTPSuccess)
24
+
25
+ result
26
+ end
27
+
28
+ def respond_to_missing?(method_name, include_private = false)
29
+ self.class::ACTIONS.include?(method_name) || super
30
+ end
31
+
32
+ private
33
+
34
+ def http(request_uri)
35
+ Net::HTTP.new(request_uri.host, request_uri.port).tap do |http|
36
+ http.use_ssl = true
37
+ http.read_timeout = TIMEOUT
38
+ http.continue_timeout = TIMEOUT
39
+ end
40
+ end
41
+
42
+ def http_method_for_action
43
+ METHOD_GET
44
+ end
45
+
46
+ def log_api_request(request_uri, request, response)
47
+ return if (logger = YandexClient.config.logger).nil?
48
+
49
+ logger.info "#{request.method} #{request_uri} #{response.code} #{response.message}"
50
+ logger.info "request headers: #{Oj.dump(request.to_hash)}"
51
+ logger.info "response headers: #{Oj.dump(response.to_hash)}"
52
+ end
53
+
54
+ def make_request(params)
55
+ request_uri = request_uri(params)
56
+ @body = request_body(params)
57
+
58
+ request = Object.const_get("Net::HTTP::#{http_method_for_action}").new(
59
+ request_uri.request_uri,
60
+ request_headers(params)
61
+ )
62
+
63
+ request.body = @body
64
+ response = http(request_uri).start { |http| http.request(request) }
65
+
66
+ log_api_request(request_uri, request, response)
67
+
68
+ response
69
+ end
70
+
71
+ def parse_response_body(response)
72
+ Oj.load(response.body, symbol_keys: true)
73
+ end
74
+
75
+ def process_errors(response, result)
76
+ klass = ERRORS_BY_CODES.fetch(response.code.to_i, ApiRequestError)
77
+
78
+ raise klass.new(
79
+ error: result.is_a?(Hash) ? result&.fetch(:error) : result,
80
+ error_description: result.is_a?(Hash) ? result&.fetch(:error_description) : nil,
81
+ code: response.code.to_i
82
+ )
83
+ end
84
+
85
+ def request_body(_params)
86
+
87
+ end
88
+
89
+ def request_headers(_params)
90
+ {}
91
+ end
92
+
93
+ def request_uri(_params)
94
+ raise 'not implemented'
95
+ end
96
+ end
97
+ end
@@ -0,0 +1,115 @@
1
+ require 'digest'
2
+
3
+ module YandexClient
4
+ module Dav
5
+ # https://tech.yandex.ru/disk/doc/dg/reference/put-docpage/
6
+ #
7
+ # cli = YandexClient::Dav::Client.new(access_token: access_token)
8
+ #
9
+ # cli.put(file: '1.txt', name: '/a/b/c/1.txt')
10
+ # cli.delete(name: '/a/b/c/1.txt')
11
+ # cli.mkcol(name: '/a/b/c')
12
+ #
13
+ # cli.propfind(name: '/a/dip.yml', depth: 0)
14
+ # cli.propfind(name: '/a', depth: 1)
15
+ # cli.propfind(name: '/', quota: true)
16
+ class Client < ::YandexClient::Client
17
+ ACTION_URL = 'https://webdav.yandex.ru'.freeze
18
+ PROPFIND_QUERY = '<?xml version="1.0" encoding="utf-8"?><propfind xmlns="DAV:"></propfind>'.freeze
19
+ PROPFIND_QUOTA_QUERY = <<~XML.freeze
20
+ <D:propfind xmlns:D="DAV:">
21
+ <D:prop>
22
+ <D:quota-available-bytes/>
23
+ <D:quota-used-bytes/>
24
+ </D:prop>
25
+ </D:propfind>
26
+ XML
27
+
28
+ # actions with header processors
29
+ ACTIONS = {
30
+ mkcol: nil,
31
+ delete: nil,
32
+
33
+ put: lambda do |params|
34
+ filename = params.fetch(:file)
35
+
36
+ etag = params[:etag] || Digest::MD5.file(filename)
37
+ sha256 = params[:sha256] || Digest::SHA256.file(filename)
38
+ size = params[:size] || File.size(filename)
39
+
40
+ {
41
+ Etag: etag.to_s,
42
+ Sha256: sha256.to_s,
43
+ Expect: '100-continue',
44
+ 'Content-Length' => size.to_s
45
+ }
46
+ end,
47
+
48
+ propfind: lambda do |params|
49
+ depth = 0
50
+ depth = params.fetch(:depth, 0) unless params.key?(:quota)
51
+
52
+ headers = {
53
+ Depth: depth.to_s,
54
+ 'Content-Type' => 'application/x-www-form-urlencoded'
55
+ }
56
+
57
+ headers['Content-Length'] = @body.length unless @body.nil? || @body.empty?
58
+ headers
59
+ end
60
+ }.freeze
61
+
62
+ BODY_PROCESSORS = {
63
+ put: ->(params) { File.read(params.fetch(:file)) },
64
+ propfind: lambda do |params|
65
+ if params.fetch(:quota, false)
66
+ PROPFIND_QUOTA_QUERY
67
+ elsif params.fetch(:depth, 0).zero?
68
+ PROPFIND_QUERY
69
+ end
70
+ end
71
+ }.freeze
72
+
73
+ RESPONSE_PARSERS = {
74
+ propfind: PropfindParser
75
+ }.freeze
76
+
77
+ def initialize(access_token:)
78
+ @access_token = access_token
79
+ end
80
+
81
+ private
82
+
83
+ def http_method_for_action
84
+ @action.to_s.capitalize
85
+ end
86
+
87
+ def parse_response_body(response)
88
+ if response.is_a?(Net::HTTPSuccess) && !(parser = RESPONSE_PARSERS[@action]).nil?
89
+ parser.call(response.body)
90
+ else
91
+ response.body
92
+ end
93
+ end
94
+
95
+ def request_body(params)
96
+ return if (proc = BODY_PROCESSORS[@action]).nil?
97
+
98
+ proc.call(params)
99
+ end
100
+
101
+ def request_headers(params)
102
+ proc = ACTIONS.fetch(@action)
103
+
104
+ headers = {Authorization: "OAuth #{@access_token}"}
105
+ headers.merge!(proc.call(params)) unless proc.nil?
106
+
107
+ headers
108
+ end
109
+
110
+ def request_uri(params)
111
+ URI.parse("#{ACTION_URL}#{params.fetch(:name)}")
112
+ end
113
+ end
114
+ end
115
+ end
@@ -0,0 +1,48 @@
1
+ require 'ox'
2
+ require 'cgi'
3
+
4
+ module YandexClient
5
+ module Dav
6
+ class PropfindParser
7
+ SUCCESS_STATUS = 'HTTP/1.1 200 OK'.freeze
8
+
9
+ PROCESSORS = {
10
+ getcontentlength: ->(value) { value.to_i },
11
+ resourcetype: ->(value) { value.is_a?(Hash) ? :folder : :file }
12
+ }.freeze
13
+
14
+ class ParseError < StandardError
15
+ end
16
+
17
+ def initialize(xml)
18
+ @document = Ox.load(xml.force_encoding('UTF-8'), mode: :hash)
19
+ end
20
+
21
+ def call
22
+ @document[:'d:multistatus'].each_with_object({}) do |node, memo|
23
+ next if (response = node[:'d:response']).nil?
24
+
25
+ name = CGI.unescape(response.fetch(:'d:href'))
26
+ memo[name] = parse_node_props(response.fetch(:'d:propstat'))
27
+ end
28
+ end
29
+
30
+ def self.call(xml)
31
+ new(xml).call
32
+ end
33
+
34
+ private
35
+
36
+ def parse_node_props(node)
37
+ raise ParseError unless node.fetch(:'d:status') == SUCCESS_STATUS
38
+
39
+ node.fetch(:'d:prop').each_with_object({}) do |(key, value), memo|
40
+ prop_key = key.to_s.gsub(/^d:/, '').to_sym
41
+ processor = PROCESSORS[prop_key]
42
+
43
+ memo[prop_key] = processor.nil? ? value : processor.call(value)
44
+ end
45
+ end
46
+ end
47
+ end
48
+ end
@@ -0,0 +1,4 @@
1
+ module YandexClient
2
+ class NotFoundError < ApiRequestError
3
+ end
4
+ end
@@ -0,0 +1,34 @@
1
+ module YandexClient
2
+ module Passport
3
+ # https://tech.yandex.ru/passport/doc/dg/reference/request-docpage/
4
+ #
5
+ # Example:
6
+ # client = YandexClient::Passport::Client.new(access_token: Token.first.access_token)
7
+ # client.info
8
+ class Client < ::YandexClient::Client
9
+ ACTION_URL = 'https://login.yandex.ru/info'.freeze
10
+ ACTIONS = %i[info].freeze
11
+
12
+ # action - info
13
+ def initialize(access_token:)
14
+ @access_token = access_token
15
+ end
16
+
17
+ private
18
+
19
+ def http(_request_uri)
20
+ @http ||= super
21
+ end
22
+
23
+ def request_uri(_params)
24
+ @request_uri ||= URI.parse(ACTION_URL)
25
+ end
26
+
27
+ def request_headers(_params)
28
+ {
29
+ Authorization: "Bearer #{@access_token}"
30
+ }
31
+ end
32
+ end
33
+ end
34
+ end
@@ -0,0 +1,3 @@
1
+ module YandexClient
2
+ VERSION = '0.1.0'.freeze
3
+ end
@@ -0,0 +1,30 @@
1
+ require 'yandex_client/version'
2
+
3
+ module YandexClient
4
+ Config = Struct.new(:api_key, :api_secret, :logger)
5
+
6
+ def self.config
7
+ @config ||= Config.new
8
+ end
9
+
10
+ def self.configure
11
+ yield config
12
+ end
13
+
14
+ autoload :Client, 'yandex_client/client'
15
+ autoload :ApiRequestError, 'yandex_client/api_request_error'
16
+ autoload :NotFoundError, 'yandex_client/not_found_error'
17
+
18
+ module Auth
19
+ autoload :Client, 'yandex_client/auth/client'
20
+ end
21
+
22
+ module Passport
23
+ autoload :Client, 'yandex_client/passport/client'
24
+ end
25
+
26
+ module Dav
27
+ autoload :Client, 'yandex_client/dav/client'
28
+ autoload :PropfindParser, 'yandex_client/dav/propfind_parser'
29
+ end
30
+ end
@@ -0,0 +1,34 @@
1
+ lib = File.expand_path("../lib", __FILE__)
2
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
3
+ require 'yandex_client/version'
4
+
5
+ Gem::Specification.new do |spec|
6
+ spec.name = 'yandex_client'
7
+ spec.version = YandexClient::VERSION
8
+ spec.authors = ['Maxim Tretyakov']
9
+ spec.email = ['max@tretyakov-ma.ru']
10
+
11
+ spec.summary = %q{Yandex Client}
12
+ spec.description = %q{Allows to use yandex disk as webdav nodes}
13
+ spec.homepage = 'https://github.com/yamax2/yandex_client'
14
+ spec.license = 'MIT'
15
+
16
+ spec.files = Dir.chdir(File.expand_path('..', __FILE__)) do
17
+ `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
18
+ end
19
+
20
+ spec.bindir = 'exe'
21
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
22
+ spec.require_paths = ['lib']
23
+
24
+ spec.add_runtime_dependency 'oj'
25
+ spec.add_runtime_dependency 'ox'
26
+
27
+ spec.add_development_dependency 'bundler'
28
+ spec.add_development_dependency 'rake', '>= 10'
29
+ spec.add_development_dependency 'rspec', '>= 3.0'
30
+ spec.add_development_dependency 'vcr'
31
+ spec.add_development_dependency 'webmock'
32
+
33
+ spec.required_ruby_version = '>= 2.3'
34
+ end
metadata ADDED
@@ -0,0 +1,164 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: yandex_client
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Maxim Tretyakov
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2019-07-31 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: oj
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: ox
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: bundler
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: rake
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: '10'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: '10'
69
+ - !ruby/object:Gem::Dependency
70
+ name: rspec
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: '3.0'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
82
+ version: '3.0'
83
+ - !ruby/object:Gem::Dependency
84
+ name: vcr
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - ">="
88
+ - !ruby/object:Gem::Version
89
+ version: '0'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - ">="
95
+ - !ruby/object:Gem::Version
96
+ version: '0'
97
+ - !ruby/object:Gem::Dependency
98
+ name: webmock
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - ">="
102
+ - !ruby/object:Gem::Version
103
+ version: '0'
104
+ type: :development
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - ">="
109
+ - !ruby/object:Gem::Version
110
+ version: '0'
111
+ description: Allows to use yandex disk as webdav nodes
112
+ email:
113
+ - max@tretyakov-ma.ru
114
+ executables: []
115
+ extensions: []
116
+ extra_rdoc_files: []
117
+ files:
118
+ - ".gitignore"
119
+ - ".rspec"
120
+ - ".travis.yml"
121
+ - Gemfile
122
+ - LICENSE.txt
123
+ - README.md
124
+ - Rakefile
125
+ - bin/console
126
+ - bin/setup
127
+ - dip.yml
128
+ - docker/Dockerfile.2.6
129
+ - docker/docker-compose.development.yml
130
+ - docker/docker-compose.yml
131
+ - lib/yandex_client.rb
132
+ - lib/yandex_client/api_request_error.rb
133
+ - lib/yandex_client/auth/client.rb
134
+ - lib/yandex_client/client.rb
135
+ - lib/yandex_client/dav/client.rb
136
+ - lib/yandex_client/dav/propfind_parser.rb
137
+ - lib/yandex_client/not_found_error.rb
138
+ - lib/yandex_client/passport/client.rb
139
+ - lib/yandex_client/version.rb
140
+ - yandex_client.gemspec
141
+ homepage: https://github.com/yamax2/yandex_client
142
+ licenses:
143
+ - MIT
144
+ metadata: {}
145
+ post_install_message:
146
+ rdoc_options: []
147
+ require_paths:
148
+ - lib
149
+ required_ruby_version: !ruby/object:Gem::Requirement
150
+ requirements:
151
+ - - ">="
152
+ - !ruby/object:Gem::Version
153
+ version: '2.3'
154
+ required_rubygems_version: !ruby/object:Gem::Requirement
155
+ requirements:
156
+ - - ">="
157
+ - !ruby/object:Gem::Version
158
+ version: '0'
159
+ requirements: []
160
+ rubygems_version: 3.0.4
161
+ signing_key:
162
+ specification_version: 4
163
+ summary: Yandex Client
164
+ test_files: []