simple_tweet 3.0.0 → 3.0.1

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: cb994313a55f3a80782b1c73c983a7551fa2a394f49aa5149efdf59372d20d40
4
- data.tar.gz: 2dff9773d979e4f907b1ad37072adc59d30d13c64d73ed26a004032a50cc2456
3
+ metadata.gz: a6ce5d4a7a448770b21c18cc4b68f25adc7f21d8814a02970864efc4c487d071
4
+ data.tar.gz: 6dfec2f42eff6f04cd8e0dc59571b31bc558b027fc20efdc87c59dd8402a47a1
5
5
  SHA512:
6
- metadata.gz: e5425884322fcb27da54bf4747c709ad412c9479daf0fd0b040209dbbec8be6f5d930505b4a72c85dabbef8a55b5817b5f5d83f7be2a8255d4e2aaa9253ec4e3
7
- data.tar.gz: 31fb1439304050a6038b19ce25520795eb3588ebcdfe29b75b1249adbbdfff932f79833c131ef3492ff784599f2e4e3301222f7885784d60de2a634652d6cbef
6
+ metadata.gz: bef5b277879212fc6c8a6c542ed70d71fd35e5c8e12ab0ab9119d50c3969e271b99b95f812b990eb4bb5ef93c9bc6b9726cb6e71fcf974112789e20da94e0b6f
7
+ data.tar.gz: '09771d8edada2fba52358e1f897410a620703d91fe87a6f1b602ec846c56e9771b4a3289908d4bcded74da60c396a235d074ae3388e61917da067422852346f5'
data/.rubocop.yml CHANGED
@@ -20,3 +20,6 @@ Metrics/MethodLength:
20
20
 
21
21
  Metrics/AbcSize:
22
22
  Max: 30
23
+
24
+ Style/FrozenStringLiteralComment:
25
+ Enabled: false
data/Gemfile CHANGED
@@ -8,3 +8,4 @@ gemspec
8
8
  gem "rake", "~> 13.0"
9
9
  gem "rspec", "~> 3.0"
10
10
  gem "rubocop", "~> 1.56"
11
+ gem "steep"
data/Gemfile.lock CHANGED
@@ -1,19 +1,35 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- simple_tweet (3.0.0)
4
+ simple_tweet (3.0.1)
5
5
  multipart-post (>= 2.2.3)
6
6
  oauth (~> 1.1.0)
7
7
 
8
8
  GEM
9
9
  remote: https://rubygems.org/
10
10
  specs:
11
+ activesupport (7.0.8)
12
+ concurrent-ruby (~> 1.0, >= 1.0.2)
13
+ i18n (>= 1.6, < 2)
14
+ minitest (>= 5.1)
15
+ tzinfo (~> 2.0)
11
16
  ast (2.4.2)
12
17
  base64 (0.1.1)
18
+ concurrent-ruby (1.2.2)
19
+ csv (3.2.7)
13
20
  diff-lcs (1.5.0)
21
+ ffi (1.15.5)
22
+ fileutils (1.7.1)
14
23
  hashie (5.0.0)
24
+ i18n (1.14.1)
25
+ concurrent-ruby (~> 1.0)
15
26
  json (2.6.3)
16
27
  language_server-protocol (3.17.0.3)
28
+ listen (3.8.0)
29
+ rb-fsevent (~> 0.10, >= 0.10.3)
30
+ rb-inotify (~> 0.9, >= 0.9.10)
31
+ logger (1.5.3)
32
+ minitest (5.20.0)
17
33
  multipart-post (2.3.0)
18
34
  oauth (1.1.0)
19
35
  oauth-tty (~> 1.0, >= 1.0.1)
@@ -28,6 +44,10 @@ GEM
28
44
  racc (1.7.1)
29
45
  rainbow (3.1.1)
30
46
  rake (13.0.6)
47
+ rb-fsevent (0.11.2)
48
+ rb-inotify (0.10.1)
49
+ ffi (~> 1.0)
50
+ rbs (3.2.1)
31
51
  regexp_parser (2.8.1)
32
52
  rexml (3.2.6)
33
53
  rspec (3.12.0)
@@ -58,20 +78,43 @@ GEM
58
78
  rubocop-ast (1.29.0)
59
79
  parser (>= 3.2.1.0)
60
80
  ruby-progressbar (1.13.0)
81
+ securerandom (0.2.2)
61
82
  snaky_hash (2.0.1)
62
83
  hashie
63
84
  version_gem (~> 1.1, >= 1.1.1)
85
+ steep (1.5.3)
86
+ activesupport (>= 5.1)
87
+ concurrent-ruby (>= 1.1.10)
88
+ csv (>= 3.0.9)
89
+ fileutils (>= 1.1.0)
90
+ json (>= 2.1.0)
91
+ language_server-protocol (>= 3.15, < 4.0)
92
+ listen (~> 3.0)
93
+ logger (>= 1.3.0)
94
+ parser (>= 3.1)
95
+ rainbow (>= 2.2.2, < 4.0)
96
+ rbs (>= 3.1.0)
97
+ securerandom (>= 0.1)
98
+ strscan (>= 1.0.0)
99
+ terminal-table (>= 2, < 4)
100
+ strscan (3.0.6)
101
+ terminal-table (3.0.2)
102
+ unicode-display_width (>= 1.1.1, < 3)
103
+ tzinfo (2.0.6)
104
+ concurrent-ruby (~> 1.0)
64
105
  unicode-display_width (2.4.2)
65
106
  version_gem (1.1.3)
66
107
 
67
108
  PLATFORMS
68
109
  arm64-darwin-21
110
+ x86_64-linux
69
111
 
70
112
  DEPENDENCIES
71
113
  rake (~> 13.0)
72
114
  rspec (~> 3.0)
73
115
  rubocop (~> 1.56)
74
116
  simple_tweet!
117
+ steep
75
118
 
76
119
  BUNDLED WITH
77
120
  2.3.24
data/Steepfile ADDED
@@ -0,0 +1,11 @@
1
+ D = Steep::Diagnostic
2
+
3
+ target :lib do
4
+ signature "sig"
5
+ check "lib"
6
+ library "net-http"
7
+
8
+ configure_code_diagnostics(D::Ruby.strict) do |config|
9
+ config[D::Ruby::UnknownConstant] = :information
10
+ end
11
+ end
@@ -27,7 +27,7 @@ module SimpleTweet
27
27
 
28
28
  # https://developer.twitter.com/en/docs/twitter-api/tweets/manage-tweets/migrate
29
29
  def tweet(message:, media_ids: [])
30
- json = { text: message }
30
+ json = { text: message } # : ::Hash[::Symbol, (::String|::Hash[::Symbol, ::Array[::String]])]
31
31
  json[:media] = { media_ids: media_ids } unless media_ids.empty?
32
32
  header = { "User-Agent": UA, "content-type": "application/json" }
33
33
  access_token.post(TW_TWEET_PATH, json.to_json, header)
@@ -55,7 +55,10 @@ module SimpleTweet
55
55
  @client.sign! req
56
56
 
57
57
  url = ::URI.parse(TW_UPLOAD_ORIGIN + TW_MEDIA_UPLOAD_PATH)
58
- https = ::Net::HTTP.new(url.host, url.port)
58
+ https = ::Net::HTTP.new(
59
+ url.host, # : ::String
60
+ url.port
61
+ )
59
62
  https.use_ssl = true
60
63
 
61
64
  https.start do |http|
@@ -165,7 +168,7 @@ module SimpleTweet
165
168
  end
166
169
 
167
170
  def create_media_metadata(media_id:, alt_text:)
168
- header = { "content-type": "application/json; charset=UTF-8" }
171
+ header = { "content-type" => "application/json; charset=UTF-8" } # : ::Hash[::String, ::String]
169
172
  req = ::Net::HTTP::Post.new(TW_METADATA_CREATE_PATH, header)
170
173
  req.body = { media_id: media_id, alt_text: { text: alt_text } }.to_json
171
174
  res = request(req)
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module SimpleTweet
4
- VERSION = "3.0.0"
4
+ VERSION = "3.0.1"
5
5
  end
data/lib/simple_tweet.rb CHANGED
@@ -11,7 +11,7 @@ module SimpleTweet
11
11
  attr_reader :response
12
12
 
13
13
  def initialize(message = nil, response: nil)
14
- super(message)
14
+ super(message) unless message.nil?
15
15
  @response = response
16
16
  end
17
17
  end
@@ -0,0 +1,50 @@
1
+ ---
2
+ sources:
3
+ - type: git
4
+ name: ruby/gem_rbs_collection
5
+ revision: 248499a924c3cb331d40ca667d40528814043788
6
+ remote: https://github.com/ruby/gem_rbs_collection.git
7
+ repo_dir: gems
8
+ path: ".gem_rbs_collection"
9
+ gems:
10
+ - name: ast
11
+ version: '2.4'
12
+ source:
13
+ type: git
14
+ name: ruby/gem_rbs_collection
15
+ revision: 248499a924c3cb331d40ca667d40528814043788
16
+ remote: https://github.com/ruby/gem_rbs_collection.git
17
+ repo_dir: gems
18
+ - name: base64
19
+ version: '0'
20
+ source:
21
+ type: stdlib
22
+ - name: hashie
23
+ version: '5.0'
24
+ source:
25
+ type: git
26
+ name: ruby/gem_rbs_collection
27
+ revision: 248499a924c3cb331d40ca667d40528814043788
28
+ remote: https://github.com/ruby/gem_rbs_collection.git
29
+ repo_dir: gems
30
+ - name: json
31
+ version: '0'
32
+ source:
33
+ type: stdlib
34
+ - name: parallel
35
+ version: '1.20'
36
+ source:
37
+ type: git
38
+ name: ruby/gem_rbs_collection
39
+ revision: 248499a924c3cb331d40ca667d40528814043788
40
+ remote: https://github.com/ruby/gem_rbs_collection.git
41
+ repo_dir: gems
42
+ - name: rainbow
43
+ version: '3.0'
44
+ source:
45
+ type: git
46
+ name: ruby/gem_rbs_collection
47
+ revision: 248499a924c3cb331d40ca667d40528814043788
48
+ remote: https://github.com/ruby/gem_rbs_collection.git
49
+ repo_dir: gems
50
+ gemfile_lock_path: Gemfile.lock
@@ -0,0 +1,17 @@
1
+ sources:
2
+ - type: git
3
+ name: ruby/gem_rbs_collection
4
+ remote: https://github.com/ruby/gem_rbs_collection.git
5
+ revision: main
6
+ repo_dir: gems
7
+
8
+ # A directory to install the downloaded RBSs
9
+ path: .gem_rbs_collection
10
+
11
+ gems:
12
+ # Skip loading rbs gem's RBS.
13
+ # It's unnecessary if you don't use rbs as a library.
14
+ - name: rbs
15
+ ignore: true
16
+ - name: steep
17
+ ignore: true
data/sig/simple_tweet.rbs CHANGED
@@ -1,4 +1,45 @@
1
1
  module SimpleTweet
2
2
  VERSION: String
3
- # See the writing guide of rbs: https://github.com/ruby/rbs#guides
3
+
4
+ module V2
5
+ class Client
6
+ TW_API_ORIGIN: String
7
+ TW_UPLOAD_ORIGIN: String
8
+ TW_MEDIA_UPLOAD_PATH: String
9
+ TW_METADATA_CREATE_PATH: String
10
+ TW_TWEET_PATH: String
11
+ UA: String
12
+ APPEND_PER: Integer
13
+
14
+ def initialize: (consumer_key: String, consumer_secret: String, access_token: String, access_token_secret: String, ?max_append_retry: Integer) -> void
15
+ def tweet: (message: String, ?media_ids: Array[String]) -> untyped
16
+ def tweet_with_media: (message: String, media_type: String, media: untyped, ?alt_text: String?) -> untyped
17
+
18
+ @consumer_key_: String
19
+ @consumer_secret_: String
20
+ @access_token_: String
21
+ @access_token_secret_: String
22
+ @max_append_retry_: Integer
23
+ @client: untyped # ::OAuth::AccessToken
24
+
25
+ private
26
+ def access_token: (?site: String) -> untyped
27
+ def request: (untyped req) -> untyped
28
+ def upload_media: (media_type: untyped, media: untyped) -> [untyped]
29
+ def init: (video: untyped) -> untyped
30
+ def append: (video: untyped, media_id: untyped, index: untyped, ?retry_count: Integer) -> nil
31
+ def finalize: (media_id: untyped) -> untyped
32
+ def status: (media_id: untyped) -> untyped
33
+ def upload_video: (video: untyped) -> [untyped]
34
+ def create_media_metadata: (media_id: String, alt_text: String?) -> untyped
35
+ end
36
+ end
37
+
38
+ class Error < StandardError
39
+ end
40
+
41
+ class UploadMediaError < Error
42
+ attr_reader response: nil
43
+ def initialize: (?String? message, ?response: nil) -> void
44
+ end
4
45
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: simple_tweet
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.0.0
4
+ version: 3.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kugayama Nana
@@ -53,9 +53,12 @@ files:
53
53
  - LICENSE.txt
54
54
  - README.md
55
55
  - Rakefile
56
+ - Steepfile
56
57
  - lib/simple_tweet.rb
57
58
  - lib/simple_tweet/v2_client.rb
58
59
  - lib/simple_tweet/version.rb
60
+ - rbs_collection.lock.yaml
61
+ - rbs_collection.yaml
59
62
  - sig/simple_tweet.rbs
60
63
  - simple_tweet.gemspec
61
64
  homepage: https://github.com/nota/simple_tweet