yandex_client 0.1.0 → 0.1.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
  SHA256:
3
- metadata.gz: 2880e2f2d5736258497e2aaf7adfe617d7bc9a1ae1ff19770e0b88c362854469
4
- data.tar.gz: 98ca385691189448b73a840cb5d0cecf4b8deb4e6042e4121f68c76e047d53a0
3
+ metadata.gz: ec95accc04a86127c16f61ad3f438ec9b42c9cb5eaa03c7589191d7a4223402f
4
+ data.tar.gz: b1a50d5dd827ab178ec54cf6d7a6613d89e97065f5117d5669583e12678c4811
5
5
  SHA512:
6
- metadata.gz: e2a248d79d823659fb906fa873b64e2a78b130b861f5b6cf8b04fa80e3e080d7587b5593816784b0f390e793bd8776c8cc8aaf535f8f0d307d2e471fcf5c9890
7
- data.tar.gz: 577d0b26cab47f90bf1b56e3b3107e79954cb4c80f57770c571e4360fe073f90494360983cadf6db9ac299cbc2a51f1c4421d72ec2c7cd36d29a5722661d3800
6
+ metadata.gz: 5cef57682df43d60b7f666bf7df6f77d51aeb41a96579048c0c5e84b616cdadc78f4d4efae2f0c006fa1df421179b857a312c4cac37250b5c7273c7f5a56fdd1
7
+ data.tar.gz: 00376bc7e7e6185bf797655630ac93509cacc567100e44f26902abfb3abd8b70e0775148ec06ff79961b8a7ea36e6be28e060b18a287acd688c7baefd1400c20
data/.travis.yml CHANGED
@@ -1,7 +1,7 @@
1
1
  sudo: false
2
2
  language: ruby
3
3
  rvm:
4
- - 2.6.3
4
+ - 2.6.5
5
5
  before_install: gem install bundler
6
6
  before_script:
7
7
  - bundle install
data/Gemfile CHANGED
@@ -1,8 +1,9 @@
1
- source "https://rubygems.org"
1
+ # frozen_string_literal: true
2
2
 
3
- git_source(:github) {|repo_name| "https://github.com/#{repo_name}" }
3
+ source 'https://rubygems.org'
4
+
5
+ git_source(:github) { |repo_name| "https://github.com/#{repo_name}" }
4
6
 
5
7
  gem 'pry-byebug'
6
8
 
7
- # Specify your gem's dependencies in yandex_client.gemspec
8
9
  gemspec
data/Rakefile CHANGED
@@ -1,6 +1,8 @@
1
- require "bundler/gem_tasks"
2
- require "rspec/core/rake_task"
1
+ # frozen_string_literal: true
2
+
3
+ require 'bundler/gem_tasks'
4
+ require 'rspec/core/rake_task'
3
5
 
4
6
  RSpec::Core::RakeTask.new(:spec)
5
7
 
6
- task :default => :spec
8
+ task default: :spec
data/dip.yml CHANGED
@@ -2,7 +2,7 @@ version: '1'
2
2
 
3
3
  environment:
4
4
  DOCKER_RUBY_VERSION: 2.6
5
- RUBY_IMAGE_TAG: 2.6.3
5
+ RUBY_IMAGE_TAG: 2.6.5
6
6
  COMPOSE_FILE_EXT: development
7
7
 
8
8
  compose:
@@ -1,9 +1,13 @@
1
- FROM ruby:2.6.3
1
+ FROM ruby:2.6.5-alpine
2
2
 
3
- RUN ln -fs /usr/share/zoneinfo/Asia/Yekaterinburg /etc/localtime \
4
- && dpkg-reconfigure -f noninteractive tzdata
3
+ RUN apk add --update --no-cache tzdata openssh-client less git build-base
4
+ RUN cp /usr/share/zoneinfo/Asia/Yekaterinburg /etc/localtime && echo 'Asia/Yekaterinburg' > /etc/timezone
5
+
6
+ RUN ssh-keyscan -H github.com >> /etc/ssh/ssh_known_hosts
7
+
8
+ ENV BUNDLE_APP_CONFIG /app/.bundle
5
9
 
6
10
  RUN echo 'gem: --no-rdoc --no-ri --no-document' > /root/.gemrc
7
- RUN gem install bundler
11
+ RUN gem install bundler -v '2.0.2'
8
12
 
9
13
  WORKDIR /app
data/lib/yandex_client.rb CHANGED
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'yandex_client/version'
2
4
 
3
5
  module YandexClient
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module YandexClient
2
4
  class ApiRequestError < StandardError
3
5
  attr_reader :error, :error_description, :code
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'uri'
2
4
 
3
5
  module YandexClient
@@ -14,7 +16,7 @@ module YandexClient
14
16
  # client.create_token(code: '9388894')
15
17
  # client.refresh_token(refresh_token: token.refresh_token)
16
18
  class Client < ::YandexClient::Client
17
- AUTH_ACTION_URL = 'https://oauth.yandex.ru/token'.freeze
19
+ AUTH_ACTION_URL = 'https://oauth.yandex.ru/token'
18
20
 
19
21
  ACTIONS = {
20
22
  create_token: 'authorization_code',
@@ -1,12 +1,14 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'oj'
2
4
  require 'net/http'
3
5
 
4
6
  module YandexClient
5
7
  # Base api client
6
8
  class Client
7
- TIMEOUT = 10
8
- METHOD_GET = 'Get'.freeze
9
- METHOD_POST = 'Post'.freeze
9
+ DEFAULT_TIMEOUT = 10
10
+ METHOD_GET = 'Get'
11
+ METHOD_POST = 'Post'
10
12
 
11
13
  ERRORS_BY_CODES = {
12
14
  404 => NotFoundError
@@ -34,8 +36,8 @@ module YandexClient
34
36
  def http(request_uri)
35
37
  Net::HTTP.new(request_uri.host, request_uri.port).tap do |http|
36
38
  http.use_ssl = true
37
- http.read_timeout = TIMEOUT
38
- http.continue_timeout = TIMEOUT
39
+ http.read_timeout = DEFAULT_TIMEOUT
40
+ http.continue_timeout = DEFAULT_TIMEOUT
39
41
  end
40
42
  end
41
43
 
@@ -83,7 +85,6 @@ module YandexClient
83
85
  end
84
86
 
85
87
  def request_body(_params)
86
-
87
88
  end
88
89
 
89
90
  def request_headers(_params)
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'digest'
2
4
 
3
5
  module YandexClient
@@ -14,9 +16,9 @@ module YandexClient
14
16
  # cli.propfind(name: '/a', depth: 1)
15
17
  # cli.propfind(name: '/', quota: true)
16
18
  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
19
+ ACTION_URL = 'https://webdav.yandex.ru'
20
+ PROPFIND_QUERY = '<?xml version="1.0" encoding="utf-8"?><propfind xmlns="DAV:"></propfind>'
21
+ PROPFIND_QUOTA_QUERY = <<~XML
20
22
  <D:propfind xmlns:D="DAV:">
21
23
  <D:prop>
22
24
  <D:quota-available-bytes/>
@@ -1,10 +1,12 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'ox'
2
4
  require 'cgi'
3
5
 
4
6
  module YandexClient
5
7
  module Dav
6
8
  class PropfindParser
7
- SUCCESS_STATUS = 'HTTP/1.1 200 OK'.freeze
9
+ SUCCESS_STATUS = 'HTTP/1.1 200 OK'
8
10
 
9
11
  PROCESSORS = {
10
12
  getcontentlength: ->(value) { value.to_i },
@@ -15,7 +17,8 @@ module YandexClient
15
17
  end
16
18
 
17
19
  def initialize(xml)
18
- @document = Ox.load(xml.force_encoding('UTF-8'), mode: :hash)
20
+ # FIXME: dup?
21
+ @document = Ox.load(xml.dup.force_encoding('UTF-8'), mode: :hash)
19
22
  end
20
23
 
21
24
  def call
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module YandexClient
2
4
  class NotFoundError < ApiRequestError
3
5
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module YandexClient
2
4
  module Passport
3
5
  # https://tech.yandex.ru/passport/doc/dg/reference/request-docpage/
@@ -6,7 +8,7 @@ module YandexClient
6
8
  # client = YandexClient::Passport::Client.new(access_token: Token.first.access_token)
7
9
  # client.info
8
10
  class Client < ::YandexClient::Client
9
- ACTION_URL = 'https://login.yandex.ru/info'.freeze
11
+ ACTION_URL = 'https://login.yandex.ru/info'
10
12
  ACTIONS = %i[info].freeze
11
13
 
12
14
  # action - info
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module YandexClient
2
- VERSION = '0.1.0'.freeze
4
+ VERSION = '0.1.1'
3
5
  end
@@ -1,4 +1,6 @@
1
- lib = File.expand_path("../lib", __FILE__)
1
+ # frozen_string_literal: true
2
+
3
+ lib = File.expand_path('lib', __dir__)
2
4
  $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
3
5
  require 'yandex_client/version'
4
6
 
@@ -8,12 +10,12 @@ Gem::Specification.new do |spec|
8
10
  spec.authors = ['Maxim Tretyakov']
9
11
  spec.email = ['max@tretyakov-ma.ru']
10
12
 
11
- spec.summary = %q{Yandex Client}
12
- spec.description = %q{Allows to use yandex disk as webdav nodes}
13
+ spec.summary = 'Yandex Client'
14
+ spec.description = 'Allows to use yandex disk as webdav nodes'
13
15
  spec.homepage = 'https://github.com/yamax2/yandex_client'
14
16
  spec.license = 'MIT'
15
17
 
16
- spec.files = Dir.chdir(File.expand_path('..', __FILE__)) do
18
+ spec.files = Dir.chdir(File.expand_path(__dir__)) do
17
19
  `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
18
20
  end
19
21
 
@@ -30,5 +32,5 @@ Gem::Specification.new do |spec|
30
32
  spec.add_development_dependency 'vcr'
31
33
  spec.add_development_dependency 'webmock'
32
34
 
33
- spec.required_ruby_version = '>= 2.3'
35
+ spec.required_ruby_version = '>= 2.4'
34
36
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: yandex_client
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Maxim Tretyakov
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2019-07-31 00:00:00.000000000 Z
11
+ date: 2019-12-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: oj
@@ -150,14 +150,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
150
150
  requirements:
151
151
  - - ">="
152
152
  - !ruby/object:Gem::Version
153
- version: '2.3'
153
+ version: '2.4'
154
154
  required_rubygems_version: !ruby/object:Gem::Requirement
155
155
  requirements:
156
156
  - - ">="
157
157
  - !ruby/object:Gem::Version
158
158
  version: '0'
159
159
  requirements: []
160
- rubygems_version: 3.0.4
160
+ rubygems_version: 3.0.6
161
161
  signing_key:
162
162
  specification_version: 4
163
163
  summary: Yandex Client