esa 1.16.0 → 1.17.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e41928b9493d3c42080c236778c7c2016ceb2e04dc6c7e7105c03c33d17a2be3
4
- data.tar.gz: 2213ceecf1a41e17bffbe4d8b407c8d10440d6af62bfd32e24d6372eb35db096
3
+ metadata.gz: 6058a2fdedc571221d20ab2cb94a099e5aa3cd082931e64273dfec7d1cdfa9f3
4
+ data.tar.gz: 3cb8caf6a576be339f0ff109be1d3b06eb68dd94322eb6c378610d50450d3827
5
5
  SHA512:
6
- metadata.gz: 2c23e000e5cde763115376d4e5208ee396af2f8d1789cb04a974a2c1ec88d8797cecebf5c72c0ed480481c0eba19000cdf852c18dd5843d5fa1772f1d31bfcdf
7
- data.tar.gz: 8ce5597d4a6a80d8bceca8266eda58f7fec265663e19a3206a160f690b4e3de3b318c1c97bf7f52cc7ff864f7eef1c3b407b0995eddf5c681f5264efb10e7324
6
+ metadata.gz: 23573acf19a411e41ebcc5a4fa973868a3f32a49461b79e13f44d04e202fdee5b5faac2caab4617ddf0e6e0ed7777974051d5127501c87f2042933e51baeea65
7
+ data.tar.gz: 841cbcabca254e7ae4bcc8f2a5cebc521bb7559bf5981e6f3123d98ee40ca164c0f42b397e4962796ef325d52ecd5aeda3e4925e1342cdc6cd20771eb661ff0d
@@ -10,7 +10,6 @@ jobs:
10
10
  matrix:
11
11
  ruby:
12
12
  # https://hub.docker.com/_/ruby
13
- - '2.4'
14
13
  - '2.5'
15
14
  - '2.6'
16
15
  - '2.7'
@@ -1,3 +1,13 @@
1
+ ## Unreleased
2
+
3
+ nothing
4
+
5
+ ## 1.17.0 (2020-07-02)
6
+
7
+ - ci: [Add specs for default_headers](https://github.com/esaio/esa-ruby/pull/45)
8
+ - add: [Add Post Append API (beta) by fukayatsu · Pull Request #46 · esaio/esa-ruby](https://github.com/esaio/esa-ruby/pull/46)
9
+ - change: Drop support for Ruby 2.4
10
+
1
11
  ## 1.16.0 (2020-01-20)
2
12
  - add: [Enable to set default_headers by fukayatsu · Pull Request #43 · esaio/esa-ruby](https://github.com/esaio/esa-ruby/pull/43)
3
13
 
data/README.md CHANGED
@@ -65,6 +65,10 @@ client.create_post(name: 'foo')
65
65
  client.update_post(post_number, name: 'bar')
66
66
  #=> PATCH /v1/teams/foobar/posts/1
67
67
 
68
+ # (beta)
69
+ client.append_post(post_number, content: 'bar')
70
+ #=> POST /v1/teams/foobar/posts/1/append
71
+
68
72
  client.delete_post(post_number)
69
73
  #=> DELETE /v1/teams/foobar/posts/1
70
74
 
@@ -27,6 +27,5 @@ Gem::Specification.new do |spec|
27
27
  spec.add_development_dependency 'pry', '~> 0.12'
28
28
  spec.add_development_dependency 'rake', '~> 13.0'
29
29
  spec.add_development_dependency 'rspec', '~> 3.9'
30
- spec.add_development_dependency 'vcr', '~> 5.0.0'
31
30
  spec.add_development_dependency 'webmock', '~> 3.7.6'
32
31
  end
@@ -43,6 +43,10 @@ module Esa
43
43
  send_patch("/v1/teams/#{current_team!}/posts/#{post_number}", wrap(params, :post), headers)
44
44
  end
45
45
 
46
+ def append_post(post_number, params = nil, headers = nil)
47
+ send_post("/v1/teams/#{current_team!}/posts/#{post_number}/append", wrap(params, :post), headers)
48
+ end
49
+
46
50
  def delete_post(post_number, params = nil, headers = nil)
47
51
  send_delete("/v1/teams/#{current_team!}/posts/#{post_number}", params, headers)
48
52
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Esa
4
- VERSION = '1.16.0'
4
+ VERSION = '1.17.0'
5
5
  end
@@ -4,11 +4,13 @@ RSpec.describe Esa::Client do
4
4
  let(:access_token) { nil }
5
5
  let(:api_endpoint) { nil }
6
6
  let(:current_team) { nil }
7
+ let(:default_headers) { {} }
7
8
  let(:options) do
8
9
  {
9
10
  access_token: access_token,
10
11
  api_endpoint: api_endpoint,
11
12
  current_team: current_team,
13
+ default_headers: default_headers
12
14
  }
13
15
  end
14
16
  subject(:client) { described_class.new(**options) }
@@ -42,9 +44,61 @@ RSpec.describe Esa::Client do
42
44
  end
43
45
  end
44
46
 
45
- # describe "#send_request", :vcr do
46
- # it 'returns Esa::Response' do
47
- # expect(client.teams).to be_a Esa::Response
48
- # end
49
- # end
47
+ describe 'default_headers' do
48
+ before do
49
+ stub_request(:any, 'https://api.esa.io/v1/teams')
50
+ .to_return do |request|
51
+ {
52
+ body: request.body,
53
+ headers: request.headers
54
+ }
55
+ end
56
+ end
57
+
58
+ context 'no default_headers option' do
59
+ it 'request with basic headers' do
60
+ response = client.teams
61
+ expect(response.headers).to eq(
62
+ 'Accept' => 'application/json',
63
+ 'User-Agent' => "Esa Ruby Gem #{Esa::VERSION}",
64
+ 'Accept-Encoding' => 'gzip;q=1.0,deflate;q=0.6,identity;q=0.3'
65
+ )
66
+ end
67
+
68
+ it 'request with basic headers and additional headers ' do
69
+ response = client.teams(nil, { 'X-Foo' => 'bar' })
70
+ expect(response.headers).to eq(
71
+ 'Accept' => 'application/json',
72
+ 'User-Agent' => "Esa Ruby Gem #{Esa::VERSION}",
73
+ 'Accept-Encoding' => 'gzip;q=1.0,deflate;q=0.6,identity;q=0.3',
74
+ 'X-Foo' => 'bar'
75
+ )
76
+ end
77
+ end
78
+
79
+ context 'with default_headers option' do
80
+ let(:default_headers) { { 'X-Default-Foo' => 'Bar' } }
81
+
82
+ it 'request with basic headers and default_headers' do
83
+ response = client.teams
84
+ expect(response.headers).to eq(
85
+ 'Accept' => 'application/json',
86
+ 'User-Agent' => "Esa Ruby Gem #{Esa::VERSION}",
87
+ 'Accept-Encoding' => 'gzip;q=1.0,deflate;q=0.6,identity;q=0.3',
88
+ 'X-Default-Foo' => 'Bar'
89
+ )
90
+ end
91
+
92
+ it 'request with basic headers and additional headers ' do
93
+ response = client.teams(nil, { 'X-Foo' => 'baz', 'X-Default-Foo' => 'qux' })
94
+ expect(response.headers).to eq(
95
+ 'Accept' => 'application/json',
96
+ 'User-Agent' => "Esa Ruby Gem #{Esa::VERSION}",
97
+ 'Accept-Encoding' => 'gzip;q=1.0,deflate;q=0.6,identity;q=0.3',
98
+ 'X-Default-Foo' => 'qux',
99
+ 'X-Foo' => 'baz'
100
+ )
101
+ end
102
+ end
103
+ end
50
104
  end
@@ -1,6 +1,5 @@
1
1
  require 'esa'
2
2
  require 'webmock/rspec'
3
- require 'vcr'
4
3
 
5
4
  # See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
6
5
  RSpec.configure do |config|
@@ -26,10 +25,3 @@ RSpec.configure do |config|
26
25
  config.order = :random
27
26
  Kernel.srand config.seed
28
27
  end
29
-
30
- VCR.configure do |c|
31
- c.cassette_library_dir = 'spec/cassettes'
32
- c.hook_into :webmock
33
- c.configure_rspec_metadata!
34
- c.filter_sensitive_data('<ACCESS_TOKEN>') { ENV['ESA_ACCESS_TOKEN'] }
35
- end
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.16.0
4
+ version: 1.17.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - fukayatsu
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-01-20 00:00:00.000000000 Z
11
+ date: 2020-07-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday
@@ -146,20 +146,6 @@ dependencies:
146
146
  - - "~>"
147
147
  - !ruby/object:Gem::Version
148
148
  version: '3.9'
149
- - !ruby/object:Gem::Dependency
150
- name: vcr
151
- requirement: !ruby/object:Gem::Requirement
152
- requirements:
153
- - - "~>"
154
- - !ruby/object:Gem::Version
155
- version: 5.0.0
156
- type: :development
157
- prerelease: false
158
- version_requirements: !ruby/object:Gem::Requirement
159
- requirements:
160
- - - "~>"
161
- - !ruby/object:Gem::Version
162
- version: 5.0.0
163
149
  - !ruby/object:Gem::Dependency
164
150
  name: webmock
165
151
  requirement: !ruby/object:Gem::Requirement
@@ -218,7 +204,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
218
204
  - !ruby/object:Gem::Version
219
205
  version: '0'
220
206
  requirements: []
221
- rubygems_version: 3.1.2
207
+ rubygems_version: 3.0.3
222
208
  signing_key:
223
209
  specification_version: 4
224
210
  summary: esa API v1 client library, written in Ruby