Skip to content

Commit

Permalink
Merge pull request #45 from true-runes/development
Browse files Browse the repository at this point in the history
v0.6.0
  • Loading branch information
nikukyugamer authored Jun 17, 2022
2 parents ea550af + 8822f9d commit 71305ea
Show file tree
Hide file tree
Showing 40 changed files with 1,219 additions and 12 deletions.
4 changes: 0 additions & 4 deletions .github/workflows/gss2020_backend.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,6 @@ name: 幻水総選挙2022 バックエンド

on:
push:
branches:
- main
- development
pull_request:
workflow_dispatch:

jobs:
Expand Down
8 changes: 8 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,12 @@ git_source(:github) { |repo| "https://github.com/#{repo}.git" }
ruby '3.1.2'

gem 'bootsnap', require: false
gem 'bugsnag'
gem 'dotenv-rails'
gem 'faraday', '1.10.0' # 'google-cloud-language' が使えるように
gem 'google-api-client'
gem 'google-cloud-language'
gem 'paper_trail'
gem 'pg'
gem 'puma'
gem 'rails'
Expand All @@ -16,3 +20,7 @@ group :development, :test do
gem 'rspec-rails', require: false
gem 'rubocop-rails', require: false
end

group :test do
gem 'factory_bot_rails'
end
83 changes: 76 additions & 7 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,8 @@ GEM
bootsnap (1.12.0)
msgpack (~> 1.2)
buftok (0.2.0)
bugsnag (6.24.2)
concurrent-ruby (~> 1.0)
builder (3.2.4)
concurrent-ruby (1.1.10)
crass (1.0.6)
Expand All @@ -89,21 +91,52 @@ GEM
railties (>= 3.2)
equalizer (0.0.11)
erubi (1.10.0)
faraday (2.3.0)
faraday-net_http (~> 2.0)
factory_bot (6.2.1)
activesupport (>= 5.0.0)
factory_bot_rails (6.2.0)
factory_bot (~> 6.2.0)
railties (>= 5.0.0)
faraday (1.10.0)
faraday-em_http (~> 1.0)
faraday-em_synchrony (~> 1.0)
faraday-excon (~> 1.1)
faraday-httpclient (~> 1.0)
faraday-multipart (~> 1.0)
faraday-net_http (~> 1.0)
faraday-net_http_persistent (~> 1.0)
faraday-patron (~> 1.0)
faraday-rack (~> 1.0)
faraday-retry (~> 1.0)
ruby2_keywords (>= 0.0.4)
faraday-net_http (2.0.3)
faraday-em_http (1.0.0)
faraday-em_synchrony (1.0.0)
faraday-excon (1.1.0)
faraday-httpclient (1.0.1)
faraday-multipart (1.0.4)
multipart-post (~> 2)
faraday-net_http (1.0.1)
faraday-net_http_persistent (1.2.0)
faraday-patron (1.0.0)
faraday-rack (1.0.0)
faraday-retry (1.0.3)
ffi (1.15.5)
ffi-compiler (1.0.1)
ffi (>= 1.0.0)
rake
gapic-common (0.9.0)
faraday (~> 1.3)
google-protobuf (~> 3.14)
googleapis-common-protos (>= 1.3.11, < 2.a)
googleapis-common-protos-types (>= 1.0.6, < 2.a)
googleauth (>= 0.17.0, < 2.a)
grpc (~> 1.36)
gems (1.2.0)
globalid (1.0.0)
activesupport (>= 5.0)
google-api-client (0.53.0)
google-apis-core (~> 0.1)
google-apis-generator (~> 0.1)
google-apis-core (0.5.0)
google-apis-core (0.6.0)
addressable (~> 2.5, >= 2.5.1)
googleauth (>= 0.16.2, < 2.a)
httpclient (>= 2.8.1, < 3.a)
Expand All @@ -112,21 +145,47 @@ GEM
retriable (>= 2.0, < 4.a)
rexml
webrick
google-apis-discovery_v1 (0.8.0)
google-apis-core (>= 0.4, < 2.a)
google-apis-generator (0.5.0)
google-apis-discovery_v1 (0.9.0)
google-apis-core (>= 0.5, < 2.a)
google-apis-generator (0.6.0)
activesupport (>= 5.0)
gems (~> 1.2)
google-apis-core (>= 0.5, < 2.a)
google-apis-discovery_v1 (~> 0.5)
thor (>= 0.20, < 2.a)
google-cloud-core (1.6.0)
google-cloud-env (~> 1.0)
google-cloud-errors (~> 1.0)
google-cloud-env (1.6.0)
faraday (>= 0.17.3, < 3.0)
google-cloud-errors (1.2.0)
google-cloud-language (1.3.4)
google-cloud-core (~> 1.6)
google-cloud-language-v1 (>= 0.4, < 2.a)
google-cloud-language-v1beta2 (>= 0.4, < 2.a)
google-cloud-language-v1 (0.4.5)
gapic-common (>= 0.7, < 2.a)
google-cloud-errors (~> 1.0)
google-cloud-language-v1beta2 (0.4.5)
gapic-common (>= 0.7, < 2.a)
google-cloud-errors (~> 1.0)
google-protobuf (3.21.1-x86_64-linux)
googleapis-common-protos (1.3.12)
google-protobuf (~> 3.14)
googleapis-common-protos-types (~> 1.2)
grpc (~> 1.27)
googleapis-common-protos-types (1.3.1)
google-protobuf (~> 3.14)
googleauth (1.1.3)
faraday (>= 0.17.3, < 3.a)
jwt (>= 1.4, < 3.0)
memoist (~> 0.16)
multi_json (~> 1.11)
os (>= 0.9, < 2.0)
signet (>= 0.16, < 2.a)
grpc (1.46.3-x86_64-linux)
google-protobuf (~> 3.19)
googleapis-common-protos-types (~> 1.0)
http (4.4.1)
addressable (~> 2.3)
http-cookie (~> 1.0)
Expand Down Expand Up @@ -179,6 +238,9 @@ GEM
nokogiri (1.13.6-x86_64-linux)
racc (~> 1.4)
os (1.1.4)
paper_trail (12.3.0)
activerecord (>= 5.2)
request_store (~> 1.1)
parallel (1.22.1)
parser (3.1.2.0)
ast (~> 2.4.1)
Expand Down Expand Up @@ -225,6 +287,8 @@ GEM
declarative (< 0.1.0)
trailblazer-option (>= 0.1.1, < 0.2.0)
uber (< 0.2.0)
request_store (1.5.1)
rack (>= 1.4)
retriable (3.1.2)
rexml (3.2.5)
rspec-core (3.11.0)
Expand Down Expand Up @@ -301,9 +365,14 @@ PLATFORMS

DEPENDENCIES
bootsnap
bugsnag
debug
dotenv-rails
factory_bot_rails
faraday (= 1.10.0)
google-api-client
google-cloud-language
paper_trail
pg
puma
rails
Expand Down
12 changes: 12 additions & 0 deletions app/lib/cloud_language.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# c = CloudLanguage.client; document = { type: :PLAIN_TEXT, content: '吾輩は猫である。名前はまだ無い。' }
# result = c.analyze_syntax(document: document)
# result.tokens.size
# result.tokens[1]

class CloudLanguage
def self.client(credentials_path: nil)
Google::Cloud::Language.language_service do |config|
config.credentials = credentials_path || ENV.fetch('CLOUD_LANGUAGE_CREDENTIALS_PATH')
end
end
end
10 changes: 10 additions & 0 deletions app/lib/twitter_rest_api.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
class TwitterRestApi
def self.client(consumer_key: nil, consumer_secret: nil, access_token: nil, access_secret: nil)
Twitter::REST::Client.new do |config|
config.consumer_key = consumer_key || ENV.fetch('TWITTER_CONSUMER_KEY', nil)
config.consumer_secret = consumer_secret || ENV.fetch('TWITTER_CONSUMER_SECRET', nil)
config.access_token = access_token || ENV.fetch('TWITTER_ACCESS_TOKEN', nil)
config.access_token_secret = access_secret || ENV.fetch('TWITTER_ACCESS_SECRET', nil)
end
end
end
Loading

0 comments on commit 71305ea

Please sign in to comment.