anzu 0.1.0 → 0.1.2

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: d97c27bef9b0713737acc17c923dbb0064077991193e5efab38c5303c5238325
4
- data.tar.gz: 15e036049b22d89402fc1f24aded173a68af638703a0022f16ab77d27ffaf7f6
3
+ metadata.gz: a5cd24067a1b0e2a4e3a42d0e604e2388c0d0137c6f0f0c846c9f4918d6f3f13
4
+ data.tar.gz: 103839131bde224143f2f8164379c21e7c7b824c96549154f12a05b995a2c885
5
5
  SHA512:
6
- metadata.gz: 7a02a88aa1394426e8c7a14642d8916e0f88d051fdb73e3fe157e2f3ff66369bc61df254d0f7382ace0eeaf09e0023f5d6949d1e34524ae3ae958049d2d19834
7
- data.tar.gz: 55de812b8fe33b570c6914b299f0486dbafe9ffdf404eff06e3dbc40990ee6477f7a9cd52b6c46478ec4438e8423733c8b0d78d6a1c9fa11ed8935b6d475514a
6
+ metadata.gz: bfb97e658d58d21ba2970bc007ca19b672bf1d371b6b6e91c4516a7c3cda7b380897a90a1251e9a772eb4093952411432ab0b57be919dff6650ec718d6b4a797
7
+ data.tar.gz: 5fc4a3a4906eec672c57c58ea34cc6428cd0c085d0ae10df677d85ace4b5dee13e08e20727a8f1e67712a3083e836becb954067f2a77307706d45ee06e882cb4
data/README.md CHANGED
@@ -1,31 +1,34 @@
1
1
  # Anzu
2
2
 
3
- TODO: Delete this and the text below, and describe your gem
3
+ 人生の質を下げてまで、働く必要ないって。自分のために生きなきゃ
4
4
 
5
- Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/anzu`. To experiment with that code, run `bin/console` for an interactive prompt.
5
+ A Twitter API wrapper for Ruby.
6
6
 
7
7
  ## Installation
8
8
 
9
- TODO: Replace `UPDATE_WITH_YOUR_GEM_NAME_PRIOR_TO_RELEASE_TO_RUBYGEMS_ORG` with your gem name right after releasing it to RubyGems.org. Please do not do it earlier due to security reasons. Alternatively, replace this section with instructions to install your gem from git if you don't plan to release to RubyGems.org.
10
-
11
9
  Install the gem and add to the application's Gemfile by executing:
12
10
 
13
- $ bundle add UPDATE_WITH_YOUR_GEM_NAME_PRIOR_TO_RELEASE_TO_RUBYGEMS_ORG
11
+ $ bundle add anzu
14
12
 
15
13
  If bundler is not being used to manage dependencies, install the gem by executing:
16
14
 
17
- $ gem install UPDATE_WITH_YOUR_GEM_NAME_PRIOR_TO_RELEASE_TO_RUBYGEMS_ORG
15
+ $ gem install anzu
18
16
 
19
17
  ## Usage
20
18
 
21
- TODO: Write usage instructions here
22
-
23
- ## Development
19
+ ```ruby
20
+ require 'anzu'
24
21
 
25
- 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.
22
+ client = Anzu::Client.new do |config|
23
+ config.consumer_key = 'consumer-key'
24
+ config.consumer_secret = 'consumer-secret'
25
+ config.access_token = 'access-token'
26
+ config.access_token_secret = 'access-token-secret'
27
+ end
26
28
 
27
- 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 the created tag, and push the `.gem` file to [rubygems.org](https://rubygems.org).
29
+ client.create_tweet_v2('tweet from anzu')
30
+ ```
28
31
 
29
- ## Contributing
32
+ # License
30
33
 
31
- Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/anzu.
34
+ This gem is provided under the MIT License.
@@ -23,10 +23,10 @@ module Anzu
23
23
  direct_message_deep_link: direct_message_deep_link,
24
24
  for_super_followers_only: for_super_followers_only,
25
25
  geo: geo_place_id && { place_id: geo_place_id }.compact,
26
- media: media_ids && { media_ids: media_ids, tagged_user_ids: media_tagged_user_ids }.compact,
26
+ media: media_ids && { media_ids: media_ids.map(&:to_s), tagged_user_ids: media_tagged_user_ids&.map(&:to_s) }.compact,
27
27
  poll: poll_options && { duration_minutes: poll_duration_minutes, options: poll_options }.compact,
28
28
  quote_tweet_id: quote_tweet_id,
29
- reply: in_reply_to_tweet_id && { in_reply_to_tweet_id: in_reply_to_tweet_id, exclude_reply_user_ids: exclude_reply_user_ids }.compact,
29
+ reply: in_reply_to_tweet_id && { in_reply_to_tweet_id: in_reply_to_tweet_id.to_s, exclude_reply_user_ids: exclude_reply_user_ids&.map(&:to_s) }.compact,
30
30
  reply_settings: reply_settings,
31
31
  text: text
32
32
  }
@@ -15,12 +15,11 @@ module Anzu
15
15
  # @param [String | nil] media_category Must be nil, tweet_image, tweet_video, tweet_gif, dm_image, dm_video, dm_gif, or subtitles
16
16
  # @param [Array<String>] additional_owners
17
17
  def upload_media_v1(bin, mime_type = nil, media_category: nil, additional_owners: nil)
18
- unless mime_type
19
- file = bin.is_a?(String) ? File.open(bin, 'rb') : bin
20
- file.binmode
21
- file.rewind
22
- bin = file.read
23
- mime_type ||= MIME::Types.type_for(file.path).find {|e| e.media_type == 'image' || e.media_type == 'video'}&.content_type
18
+ unless bin.is_a?(String)
19
+ mime_type ||= MIME::Types.type_for(bin.path).find {|e| e.media_type == 'image' || e.media_type == 'video'}&.content_type
20
+ bin.binmode
21
+ bin.rewind
22
+ bin = bin.read
24
23
  end
25
24
 
26
25
  unless media_category
data/lib/anzu/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Anzu
4
- VERSION = '0.1.0'
4
+ VERSION = '0.1.2'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: anzu
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ishotihadus
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-04-15 00:00:00.000000000 Z
11
+ date: 2023-04-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: mime-types
@@ -48,7 +48,6 @@ files:
48
48
  - ".rspec"
49
49
  - ".rubocop.yml"
50
50
  - Gemfile
51
- - Gemfile.lock
52
51
  - LICENSE
53
52
  - README.md
54
53
  - Rakefile
@@ -78,7 +77,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
78
77
  - !ruby/object:Gem::Version
79
78
  version: '0'
80
79
  requirements: []
81
- rubygems_version: 3.4.1
80
+ rubygems_version: 3.4.10
82
81
  signing_key:
83
82
  specification_version: 4
84
83
  summary: Twitter API wrapper for Ruby
data/Gemfile.lock DELETED
@@ -1,40 +0,0 @@
1
- PATH
2
- remote: .
3
- specs:
4
- anzu (0.1.0)
5
- mime-types
6
- simple_oauth
7
-
8
- GEM
9
- remote: https://rubygems.org/
10
- specs:
11
- diff-lcs (1.5.0)
12
- mime-types (3.4.1)
13
- mime-types-data (~> 3.2015)
14
- mime-types-data (3.2023.0218.1)
15
- rake (13.0.6)
16
- rspec (3.12.0)
17
- rspec-core (~> 3.12.0)
18
- rspec-expectations (~> 3.12.0)
19
- rspec-mocks (~> 3.12.0)
20
- rspec-core (3.12.1)
21
- rspec-support (~> 3.12.0)
22
- rspec-expectations (3.12.2)
23
- diff-lcs (>= 1.2.0, < 2.0)
24
- rspec-support (~> 3.12.0)
25
- rspec-mocks (3.12.5)
26
- diff-lcs (>= 1.2.0, < 2.0)
27
- rspec-support (~> 3.12.0)
28
- rspec-support (3.12.0)
29
- simple_oauth (0.3.1)
30
-
31
- PLATFORMS
32
- arm64-darwin-22
33
-
34
- DEPENDENCIES
35
- anzu!
36
- rake (~> 13.0)
37
- rspec (~> 3.0)
38
-
39
- BUNDLED WITH
40
- 2.4.12