esa 1.14.0 → 1.16.0

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: cda2802df0365be2f9c586be80d4220843dee27328dd2a91746e5335119f46a1
4
- data.tar.gz: dc8f7dcf49b11a31042459a8efbe1b2ed704688a88ccc7280e7217861faba208
3
+ metadata.gz: e41928b9493d3c42080c236778c7c2016ceb2e04dc6c7e7105c03c33d17a2be3
4
+ data.tar.gz: 2213ceecf1a41e17bffbe4d8b407c8d10440d6af62bfd32e24d6372eb35db096
5
5
  SHA512:
6
- metadata.gz: 0d3476f02ae44d634adeb12b54716b1850476a45edc759c90ba2bd08cfea5fd609b070338b75c9797c57fc24d223ec3096242c01f2fe25fa6e0e97fbfa1018b2
7
- data.tar.gz: 43b3ab933dcf514436b43cd7ec02e69a05f14c33a0bffed7f488762e89af5bf3cee911153613d0800eed0890d417403aaadf863cf9c5ca46ea603d97a1e8aeca
6
+ metadata.gz: 2c23e000e5cde763115376d4e5208ee396af2f8d1789cb04a974a2c1ec88d8797cecebf5c72c0ed480481c0eba19000cdf852c18dd5843d5fa1772f1d31bfcdf
7
+ data.tar.gz: 8ce5597d4a6a80d8bceca8266eda58f7fec265663e19a3206a160f690b4e3de3b318c1c97bf7f52cc7ff864f7eef1c3b407b0995eddf5c681f5264efb10e7324
@@ -0,0 +1,27 @@
1
+ name: build
2
+
3
+ on: [push]
4
+
5
+ jobs:
6
+ build:
7
+ runs-on: ubuntu-latest
8
+
9
+ strategy:
10
+ matrix:
11
+ ruby:
12
+ # https://hub.docker.com/_/ruby
13
+ - '2.4'
14
+ - '2.5'
15
+ - '2.6'
16
+ - '2.7'
17
+ - 'latest'
18
+ container:
19
+ image: ruby:${{ matrix.ruby }}
20
+
21
+ steps:
22
+ - uses: actions/checkout@v1
23
+ - name: Build and test with Rake
24
+ run: |
25
+ gem install bundler
26
+ bundle install --jobs 4 --retry 3
27
+ bundle exec rake
data/.rspec CHANGED
@@ -1,4 +1,3 @@
1
1
  --color
2
2
  --require spec_helper
3
3
  --format=progress
4
- <%= "--format=Nc" unless ENV["CI"] %>
@@ -1,3 +1,11 @@
1
+ ## 1.16.0 (2020-01-20)
2
+ - add: [Enable to set default_headers by fukayatsu · Pull Request #43 · esaio/esa-ruby](https://github.com/esaio/esa-ruby/pull/43)
3
+
4
+ ## 1.15.0 (2019-12-27)
5
+ - add: [Add ApiMethods#delete_member by fukayatsu · Pull Request #40 · esaio/esa-ruby](https://github.com/esaio/esa-ruby/pull/40)
6
+ - ci: [Use github actions for CI by fukayatsu · Pull Request #38 · esaio/esa-ruby](https://github.com/esaio/esa-ruby/pull/38)
7
+ - ci: [Update development environment by fukayatsu · Pull Request #37 · esaio/esa-ruby](https://github.com/esaio/esa-ruby/pull/37)
8
+
1
9
  ## 1.14.0 (2018-12-13)
2
10
  - changed: [Relax gem dependencies by ppworks · Pull Request #35 · esaio/esa-ruby](https://github.com/esaio/esa-ruby/pull/35)
3
11
 
data/README.md CHANGED
@@ -1,5 +1,6 @@
1
1
  # esa-ruby
2
- [![Build Status](https://travis-ci.org/esaio/esa-ruby.svg)](https://travis-ci.org/esaio/esa-ruby)
2
+ [![Build Status](https://github.com/esaio/esa-ruby/workflows/build/badge.svg)](https://github.com/esaio/esa-ruby/actions)
3
+
3
4
 
4
5
  esa API v1 client library, written in Ruby
5
6
 
@@ -42,6 +43,10 @@ client.stats
42
43
  client.members
43
44
  #=> GET /v1/teams/bar/members
44
45
 
46
+ screen_name = 'alice'
47
+ client.delete_member(screen_name)
48
+ #=> DELETE /v1/teams/bar/members/alice
49
+
45
50
  # Post API
46
51
  client.posts
47
52
  #=> GET /v1/teams/foo/posts
@@ -1,34 +1,32 @@
1
- # coding: utf-8
2
- lib = File.expand_path('../lib', __FILE__)
1
+ # frozen_string_literal: true
2
+
3
+ lib = File.expand_path('lib', __dir__)
3
4
  $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
5
  require 'esa/version'
5
6
 
6
7
  Gem::Specification.new do |spec|
7
- spec.name = "esa"
8
+ spec.name = 'esa'
8
9
  spec.version = Esa::VERSION
9
- spec.authors = ["fukayatsu"]
10
- spec.email = ["fukayatsu@gmail.com"]
11
- spec.summary = %q{esa API v1 client library, written in Ruby}
12
- spec.description = %q{esa API v1 client library, written in Ruby}
13
- spec.homepage = "https://github.com/esaio/esa-ruby/"
14
- spec.license = "MIT"
10
+ spec.authors = ['fukayatsu']
11
+ spec.email = ['fukayatsu@gmail.com']
12
+ spec.summary = 'esa API v1 client library, written in Ruby'
13
+ spec.homepage = 'https://github.com/esaio/esa-ruby/'
14
+ spec.license = 'MIT'
15
15
 
16
16
  spec.files = `git ls-files -z`.split("\x0")
17
17
  spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
18
18
  spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
- spec.require_paths = ["lib"]
19
+ spec.require_paths = ['lib']
20
+
21
+ spec.add_runtime_dependency 'faraday', '~> 0.9', '< 1.0'
22
+ spec.add_runtime_dependency 'faraday_middleware', '~> 0.12', '< 1.0'
23
+ spec.add_runtime_dependency 'mime-types', '>= 2.6', '< 4.0'
24
+ spec.add_runtime_dependency 'multi_xml', '>= 0.5.5', '< 1.0'
20
25
 
21
- spec.add_runtime_dependency "faraday", "~> 0.9"
22
- spec.add_runtime_dependency "faraday_middleware"
23
- spec.add_runtime_dependency "mime-types", '>= 2.6'
24
- spec.add_runtime_dependency "multi_xml", '>= 0.5.5'
25
- spec.add_development_dependency "bundler", "~> 1.7"
26
- spec.add_development_dependency "rake", "~> 10.0"
27
- spec.add_development_dependency "pry"
28
- spec.add_development_dependency "rspec"
29
- spec.add_development_dependency "webmock"
30
- spec.add_development_dependency "vcr"
31
- spec.add_development_dependency "guard"
32
- spec.add_development_dependency "guard-rspec"
33
- spec.add_development_dependency "rspec-nc"
26
+ spec.add_development_dependency 'bundler', '~> 2.0'
27
+ spec.add_development_dependency 'pry', '~> 0.12'
28
+ spec.add_development_dependency 'rake', '~> 13.0'
29
+ spec.add_development_dependency 'rspec', '~> 3.9'
30
+ spec.add_development_dependency 'vcr', '~> 5.0.0'
31
+ spec.add_development_dependency 'webmock', '~> 3.7.6'
34
32
  end
@@ -23,6 +23,10 @@ module Esa
23
23
  send_get("/v1/teams/#{current_team!}/members", params, headers)
24
24
  end
25
25
 
26
+ def delete_member(screen_name, params = nil, headers = nil)
27
+ send_delete("/v1/teams/#{current_team!}/members/#{screen_name}", params, headers)
28
+ end
29
+
26
30
  def posts(params = nil, headers = nil)
27
31
  send_get("/v1/teams/#{current_team!}/posts", params, headers)
28
32
  end
@@ -8,14 +8,14 @@ module Esa
8
8
 
9
9
  include ApiMethods
10
10
 
11
- def initialize(access_token: nil, api_endpoint: nil, current_team: nil, retry_on_rate_limit_exceeded: true)
11
+ def initialize(access_token: nil, api_endpoint: nil, current_team: nil, default_headers: {}, retry_on_rate_limit_exceeded: true)
12
12
  @access_token = access_token
13
13
  @api_endpoint = api_endpoint
14
14
  @current_team = current_team
15
-
15
+ @default_headers = default_headers
16
16
  @retry_on_rate_limit_exceeded = retry_on_rate_limit_exceeded
17
17
  end
18
- attr_accessor :current_team, :retry_on_rate_limit_exceeded
18
+ attr_accessor :current_team, :default_headers, :retry_on_rate_limit_exceeded
19
19
 
20
20
  def current_team!
21
21
  raise TeamNotSpecifiedError, "current_team is not specified" unless @current_team
@@ -87,30 +87,28 @@ module Esa
87
87
  private
88
88
 
89
89
  def faraday_options
90
- {
91
- url: faraday_url,
92
- headers: faraday_headers
93
- }
90
+ { url: api_url, headers: api_headers }
94
91
  end
95
92
 
96
- def default_headers
97
- {
98
- 'Accept' => 'application/json',
99
- 'User-Agent' => "Esa Ruby Gem #{Esa::VERSION}",
100
- }
101
- end
93
+ def api_headers
94
+ headers = {
95
+ 'Accept' => 'application/json',
96
+ 'User-Agent' => "Esa Ruby Gem #{Esa::VERSION}"
97
+ }.merge(default_headers)
102
98
 
103
- def faraday_headers
104
- return default_headers unless access_token
105
- default_headers.merge(Authorization: "Bearer #{access_token}")
99
+ if access_token
100
+ headers.merge(Authorization: "Bearer #{access_token}")
101
+ else
102
+ headers
103
+ end
106
104
  end
107
105
 
108
106
  def access_token
109
107
  @access_token || ENV['ESA_ACCESS_TOKEN']
110
108
  end
111
109
 
112
- def faraday_url
113
- @api_endpoint || ENV["ESA_API_ENDPOINT"] || "https://api.esa.io"
110
+ def api_url
111
+ @api_endpoint || ENV['ESA_API_ENDPOINT'] || 'https://api.esa.io'
114
112
  end
115
113
 
116
114
  def wait_for(wait_sec)
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Esa
2
- VERSION = '1.14.0'
4
+ VERSION = '1.16.0'
3
5
  end
@@ -11,7 +11,7 @@ RSpec.describe Esa::Client do
11
11
  current_team: current_team,
12
12
  }
13
13
  end
14
- subject(:client) { described_class.new(options) }
14
+ subject(:client) { described_class.new(**options) }
15
15
 
16
16
  describe "#current_team!" do
17
17
  context 'team not specified' do
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: esa
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.14.0
4
+ version: 1.16.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - fukayatsu
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-12-13 00:00:00.000000000 Z
11
+ date: 2020-01-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday
@@ -17,6 +17,9 @@ dependencies:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
19
  version: '0.9'
20
+ - - "<"
21
+ - !ruby/object:Gem::Version
22
+ version: '1.0'
20
23
  type: :runtime
21
24
  prerelease: false
22
25
  version_requirements: !ruby/object:Gem::Requirement
@@ -24,20 +27,29 @@ dependencies:
24
27
  - - "~>"
25
28
  - !ruby/object:Gem::Version
26
29
  version: '0.9'
30
+ - - "<"
31
+ - !ruby/object:Gem::Version
32
+ version: '1.0'
27
33
  - !ruby/object:Gem::Dependency
28
34
  name: faraday_middleware
29
35
  requirement: !ruby/object:Gem::Requirement
30
36
  requirements:
31
- - - ">="
37
+ - - "~>"
38
+ - !ruby/object:Gem::Version
39
+ version: '0.12'
40
+ - - "<"
32
41
  - !ruby/object:Gem::Version
33
- version: '0'
42
+ version: '1.0'
34
43
  type: :runtime
35
44
  prerelease: false
36
45
  version_requirements: !ruby/object:Gem::Requirement
37
46
  requirements:
38
- - - ">="
47
+ - - "~>"
39
48
  - !ruby/object:Gem::Version
40
- version: '0'
49
+ version: '0.12'
50
+ - - "<"
51
+ - !ruby/object:Gem::Version
52
+ version: '1.0'
41
53
  - !ruby/object:Gem::Dependency
42
54
  name: mime-types
43
55
  requirement: !ruby/object:Gem::Requirement
@@ -45,6 +57,9 @@ dependencies:
45
57
  - - ">="
46
58
  - !ruby/object:Gem::Version
47
59
  version: '2.6'
60
+ - - "<"
61
+ - !ruby/object:Gem::Version
62
+ version: '4.0'
48
63
  type: :runtime
49
64
  prerelease: false
50
65
  version_requirements: !ruby/object:Gem::Requirement
@@ -52,6 +67,9 @@ dependencies:
52
67
  - - ">="
53
68
  - !ruby/object:Gem::Version
54
69
  version: '2.6'
70
+ - - "<"
71
+ - !ruby/object:Gem::Version
72
+ version: '4.0'
55
73
  - !ruby/object:Gem::Dependency
56
74
  name: multi_xml
57
75
  requirement: !ruby/object:Gem::Requirement
@@ -59,6 +77,9 @@ dependencies:
59
77
  - - ">="
60
78
  - !ruby/object:Gem::Version
61
79
  version: 0.5.5
80
+ - - "<"
81
+ - !ruby/object:Gem::Version
82
+ version: '1.0'
62
83
  type: :runtime
63
84
  prerelease: false
64
85
  version_requirements: !ruby/object:Gem::Requirement
@@ -66,145 +87,105 @@ dependencies:
66
87
  - - ">="
67
88
  - !ruby/object:Gem::Version
68
89
  version: 0.5.5
90
+ - - "<"
91
+ - !ruby/object:Gem::Version
92
+ version: '1.0'
69
93
  - !ruby/object:Gem::Dependency
70
94
  name: bundler
71
95
  requirement: !ruby/object:Gem::Requirement
72
96
  requirements:
73
97
  - - "~>"
74
98
  - !ruby/object:Gem::Version
75
- version: '1.7'
99
+ version: '2.0'
76
100
  type: :development
77
101
  prerelease: false
78
102
  version_requirements: !ruby/object:Gem::Requirement
79
103
  requirements:
80
104
  - - "~>"
81
105
  - !ruby/object:Gem::Version
82
- version: '1.7'
106
+ version: '2.0'
83
107
  - !ruby/object:Gem::Dependency
84
- name: rake
108
+ name: pry
85
109
  requirement: !ruby/object:Gem::Requirement
86
110
  requirements:
87
111
  - - "~>"
88
112
  - !ruby/object:Gem::Version
89
- version: '10.0'
113
+ version: '0.12'
90
114
  type: :development
91
115
  prerelease: false
92
116
  version_requirements: !ruby/object:Gem::Requirement
93
117
  requirements:
94
118
  - - "~>"
95
119
  - !ruby/object:Gem::Version
96
- version: '10.0'
120
+ version: '0.12'
97
121
  - !ruby/object:Gem::Dependency
98
- name: pry
122
+ name: rake
99
123
  requirement: !ruby/object:Gem::Requirement
100
124
  requirements:
101
- - - ">="
125
+ - - "~>"
102
126
  - !ruby/object:Gem::Version
103
- version: '0'
127
+ version: '13.0'
104
128
  type: :development
105
129
  prerelease: false
106
130
  version_requirements: !ruby/object:Gem::Requirement
107
131
  requirements:
108
- - - ">="
132
+ - - "~>"
109
133
  - !ruby/object:Gem::Version
110
- version: '0'
134
+ version: '13.0'
111
135
  - !ruby/object:Gem::Dependency
112
136
  name: rspec
113
137
  requirement: !ruby/object:Gem::Requirement
114
138
  requirements:
115
- - - ">="
116
- - !ruby/object:Gem::Version
117
- version: '0'
118
- type: :development
119
- prerelease: false
120
- version_requirements: !ruby/object:Gem::Requirement
121
- requirements:
122
- - - ">="
123
- - !ruby/object:Gem::Version
124
- version: '0'
125
- - !ruby/object:Gem::Dependency
126
- name: webmock
127
- requirement: !ruby/object:Gem::Requirement
128
- requirements:
129
- - - ">="
139
+ - - "~>"
130
140
  - !ruby/object:Gem::Version
131
- version: '0'
141
+ version: '3.9'
132
142
  type: :development
133
143
  prerelease: false
134
144
  version_requirements: !ruby/object:Gem::Requirement
135
145
  requirements:
136
- - - ">="
146
+ - - "~>"
137
147
  - !ruby/object:Gem::Version
138
- version: '0'
148
+ version: '3.9'
139
149
  - !ruby/object:Gem::Dependency
140
150
  name: vcr
141
151
  requirement: !ruby/object:Gem::Requirement
142
152
  requirements:
143
- - - ">="
144
- - !ruby/object:Gem::Version
145
- version: '0'
146
- type: :development
147
- prerelease: false
148
- version_requirements: !ruby/object:Gem::Requirement
149
- requirements:
150
- - - ">="
151
- - !ruby/object:Gem::Version
152
- version: '0'
153
- - !ruby/object:Gem::Dependency
154
- name: guard
155
- requirement: !ruby/object:Gem::Requirement
156
- requirements:
157
- - - ">="
158
- - !ruby/object:Gem::Version
159
- version: '0'
160
- type: :development
161
- prerelease: false
162
- version_requirements: !ruby/object:Gem::Requirement
163
- requirements:
164
- - - ">="
165
- - !ruby/object:Gem::Version
166
- version: '0'
167
- - !ruby/object:Gem::Dependency
168
- name: guard-rspec
169
- requirement: !ruby/object:Gem::Requirement
170
- requirements:
171
- - - ">="
153
+ - - "~>"
172
154
  - !ruby/object:Gem::Version
173
- version: '0'
155
+ version: 5.0.0
174
156
  type: :development
175
157
  prerelease: false
176
158
  version_requirements: !ruby/object:Gem::Requirement
177
159
  requirements:
178
- - - ">="
160
+ - - "~>"
179
161
  - !ruby/object:Gem::Version
180
- version: '0'
162
+ version: 5.0.0
181
163
  - !ruby/object:Gem::Dependency
182
- name: rspec-nc
164
+ name: webmock
183
165
  requirement: !ruby/object:Gem::Requirement
184
166
  requirements:
185
- - - ">="
167
+ - - "~>"
186
168
  - !ruby/object:Gem::Version
187
- version: '0'
169
+ version: 3.7.6
188
170
  type: :development
189
171
  prerelease: false
190
172
  version_requirements: !ruby/object:Gem::Requirement
191
173
  requirements:
192
- - - ">="
174
+ - - "~>"
193
175
  - !ruby/object:Gem::Version
194
- version: '0'
195
- description: esa API v1 client library, written in Ruby
176
+ version: 3.7.6
177
+ description:
196
178
  email:
197
179
  - fukayatsu@gmail.com
198
180
  executables: []
199
181
  extensions: []
200
182
  extra_rdoc_files: []
201
183
  files:
184
+ - ".github/workflows/build.yml"
202
185
  - ".gitignore"
203
186
  - ".rspec"
204
- - ".travis.yml"
205
187
  - CHANGELOG.md
206
188
  - Gemfile
207
- - Guardfile
208
189
  - LICENSE.txt
209
190
  - README.md
210
191
  - Rakefile
@@ -237,8 +218,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
237
218
  - !ruby/object:Gem::Version
238
219
  version: '0'
239
220
  requirements: []
240
- rubyforge_project:
241
- rubygems_version: 2.7.6
221
+ rubygems_version: 3.1.2
242
222
  signing_key:
243
223
  specification_version: 4
244
224
  summary: esa API v1 client library, written in Ruby
@@ -1,6 +0,0 @@
1
- language: ruby
2
- rvm:
3
- - 2.2.6
4
- - 2.3.3
5
- - 2.4.0
6
- - ruby-head
data/Guardfile DELETED
@@ -1,17 +0,0 @@
1
- # More info at https://github.com/guard/guard#readme
2
- guard :rspec, cmd: "bundle exec rspec" do
3
- require "guard/rspec/dsl"
4
- dsl = Guard::RSpec::Dsl.new(self)
5
-
6
- # RSpec files
7
- rspec = dsl.rspec
8
- watch(rspec.spec_helper) { rspec.spec_dir }
9
- watch(rspec.spec_support) { rspec.spec_dir }
10
- watch(rspec.spec_files)
11
-
12
- # Ruby files
13
- ruby = dsl.ruby
14
- dsl.watch_spec_files_for(ruby.lib_files)
15
-
16
- watch(%r{^lib/(.+)\.rb$}) { |m| "spec/#{m[1]}_spec.rb" }
17
- end