prismdb 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.coveralls.yml +1 -0
- data/.github/workflows/test.yml +105 -0
- data/.gitignore +13 -0
- data/.rspec +3 -0
- data/CHANGELOG.md +6 -0
- data/Gemfile +16 -0
- data/LICENSE.txt +21 -0
- data/README.md +91 -0
- data/Rakefile +6 -0
- data/bin/console +14 -0
- data/bin/setup +8 -0
- data/lib/prismdb.rb +16 -0
- data/lib/prismdb/client.rb +103 -0
- data/lib/prismdb/configuration.rb +11 -0
- data/lib/prismdb/response.rb +7 -0
- data/lib/prismdb/version.rb +3 -0
- data/prismdb.gemspec +31 -0
- metadata +105 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: adf12c106c1bc6f335003bd273af6ed4801cf96660dc11048cf73a07f021ca5d
|
4
|
+
data.tar.gz: d4ea58e36efdf9845e79675dbc5cc03bbff423b6230105ea63c762290502e897
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 5ca38fed031c50bc8c0cbe55befdd890e70b6357a9a3019d93d821cee4a3328279db3b2ef6fc975b42bce1d6bcd23937b215b824d8915c489560696eabcb990a
|
7
|
+
data.tar.gz: bd290f86e12ea8109b6486375296b0e44f903ac496dabfc8b5f68f48b4634c3cfc334a86a7cfa5b4409ffaa4f52623a69e3a5925ff1051ea09734cd5a33e861c
|
data/.coveralls.yml
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
repo_token: v7vHQpfptuMdfcdwWvbQ1JCAktHx8sJey
|
@@ -0,0 +1,105 @@
|
|
1
|
+
name: test
|
2
|
+
|
3
|
+
on:
|
4
|
+
push:
|
5
|
+
branches:
|
6
|
+
- master
|
7
|
+
pull_request:
|
8
|
+
types:
|
9
|
+
- opened
|
10
|
+
- synchronize
|
11
|
+
- reopened
|
12
|
+
schedule:
|
13
|
+
- cron: "0 10 * * 5" # JST 19:00 (Fri)
|
14
|
+
|
15
|
+
env:
|
16
|
+
CI: "true"
|
17
|
+
|
18
|
+
jobs:
|
19
|
+
test:
|
20
|
+
runs-on: ubuntu-latest
|
21
|
+
|
22
|
+
container: ${{ matrix.ruby }}
|
23
|
+
|
24
|
+
strategy:
|
25
|
+
fail-fast: false
|
26
|
+
|
27
|
+
matrix:
|
28
|
+
ruby:
|
29
|
+
- ruby:2.5
|
30
|
+
- ruby:2.6
|
31
|
+
- ruby:2.7
|
32
|
+
- rubylang/ruby:master-nightly-bionic
|
33
|
+
include:
|
34
|
+
- ruby: rubylang/ruby:master-nightly-bionic
|
35
|
+
allow_failures: "true"
|
36
|
+
|
37
|
+
steps:
|
38
|
+
- uses: actions/checkout@v2
|
39
|
+
- name: Cache vendor/bundle
|
40
|
+
uses: actions/cache@v1
|
41
|
+
id: cache_gem
|
42
|
+
with:
|
43
|
+
path: vendor/bundle
|
44
|
+
key: v1-gem-${{ runner.os }}-${{ matrix.ruby }}-${{ github.sha }}
|
45
|
+
restore-keys: |
|
46
|
+
v1-gem-${{ runner.os }}-${{ matrix.ruby }}-
|
47
|
+
continue-on-error: ${{ matrix.allow_failures == 'true' }}
|
48
|
+
|
49
|
+
- name: bundle update
|
50
|
+
run: |
|
51
|
+
set -xe
|
52
|
+
bundle config path vendor/bundle
|
53
|
+
bundle update --jobs $(nproc) --retry 3
|
54
|
+
continue-on-error: ${{ matrix.allow_failures == 'true' }}
|
55
|
+
|
56
|
+
- name: Setup Code Climate Test Reporter
|
57
|
+
uses: aktions/codeclimate-test-reporter@v1
|
58
|
+
with:
|
59
|
+
codeclimate-test-reporter-id: ${{ secrets.CC_TEST_REPORTER_ID }}
|
60
|
+
command: before-build
|
61
|
+
if: matrix.ruby >= 'ruby:2.4'
|
62
|
+
continue-on-error: true
|
63
|
+
|
64
|
+
- name: Run test
|
65
|
+
run: |
|
66
|
+
set -xe
|
67
|
+
bundle exec rspec
|
68
|
+
continue-on-error: ${{ matrix.allow_failures == 'true' }}
|
69
|
+
|
70
|
+
- name: Teardown Code Climate Test Reporter
|
71
|
+
uses: aktions/codeclimate-test-reporter@v1
|
72
|
+
with:
|
73
|
+
codeclimate-test-reporter-id: ${{ secrets.CC_TEST_REPORTER_ID }}
|
74
|
+
command: after-build
|
75
|
+
if: matrix.ruby >= 'ruby:2.4' && always()
|
76
|
+
continue-on-error: true
|
77
|
+
|
78
|
+
- name: Slack Notification (not success)
|
79
|
+
uses: homoluctus/slatify@master
|
80
|
+
if: "! success()"
|
81
|
+
continue-on-error: true
|
82
|
+
with:
|
83
|
+
job_name: ${{ format('*build* ({0})', matrix.ruby) }}
|
84
|
+
type: ${{ job.status }}
|
85
|
+
icon_emoji: ":octocat:"
|
86
|
+
url: ${{ secrets.SLACK_WEBHOOK }}
|
87
|
+
token: ${{ secrets.GITHUB_TOKEN }}
|
88
|
+
|
89
|
+
notify:
|
90
|
+
needs:
|
91
|
+
- test
|
92
|
+
|
93
|
+
runs-on: ubuntu-latest
|
94
|
+
|
95
|
+
steps:
|
96
|
+
- name: Slack Notification (success)
|
97
|
+
uses: homoluctus/slatify@master
|
98
|
+
if: always()
|
99
|
+
continue-on-error: true
|
100
|
+
with:
|
101
|
+
job_name: '*build*'
|
102
|
+
type: ${{ job.status }}
|
103
|
+
icon_emoji: ":octocat:"
|
104
|
+
url: ${{ secrets.SLACK_WEBHOOK }}
|
105
|
+
token: ${{ secrets.GITHUB_TOKEN }}
|
data/.gitignore
ADDED
data/.rspec
ADDED
data/CHANGELOG.md
ADDED
data/Gemfile
ADDED
@@ -0,0 +1,16 @@
|
|
1
|
+
source "https://rubygems.org"
|
2
|
+
|
3
|
+
# Specify your gem's dependencies in prismdb.gemspec
|
4
|
+
gemspec
|
5
|
+
|
6
|
+
gem "coveralls"
|
7
|
+
gem "rake", "~> 12.0"
|
8
|
+
gem "rspec", "~> 3.0"
|
9
|
+
gem "rspec-its"
|
10
|
+
|
11
|
+
# Workaround for cc-test-reporter with SimpleCov 0.18.
|
12
|
+
# Stop upgrading SimpleCov until the following issue will be resolved.
|
13
|
+
# https://github.com/codeclimate/test-reporter/issues/418
|
14
|
+
gem "simplecov", "~> 0.10", "< 0.18"
|
15
|
+
|
16
|
+
gem "webmock", require: "webmock/rspec"
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2020 sue445
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
13
|
+
all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,91 @@
|
|
1
|
+
# Prismdb
|
2
|
+
[PrismDB](https://prismdb.takanakahiko.me/) API client for ruby
|
3
|
+
|
4
|
+
[![test](https://github.com/sue445/prismdb-ruby/workflows/test/badge.svg?branch=master)](https://github.com/sue445/prismdb-ruby/actions?query=workflow%3Atest)
|
5
|
+
[![Coverage Status](https://coveralls.io/repos/github/sue445/prismdb-ruby/badge.svg?branch=master)](https://coveralls.io/github/sue445/prismdb-ruby?branch=master)
|
6
|
+
[![Maintainability](https://api.codeclimate.com/v1/badges/091d941f30ffc69fbd4b/maintainability)](https://codeclimate.com/github/sue445/prismdb-ruby/maintainability)
|
7
|
+
|
8
|
+
## Installation
|
9
|
+
|
10
|
+
Add this line to your application's Gemfile:
|
11
|
+
|
12
|
+
```ruby
|
13
|
+
gem 'prismdb'
|
14
|
+
```
|
15
|
+
|
16
|
+
And then execute:
|
17
|
+
|
18
|
+
$ bundle install
|
19
|
+
|
20
|
+
Or install it yourself as:
|
21
|
+
|
22
|
+
$ gem install prismdb
|
23
|
+
|
24
|
+
## Usage
|
25
|
+
|
26
|
+
```ruby
|
27
|
+
require "prismdb"
|
28
|
+
|
29
|
+
client = Prismdb::Client.new
|
30
|
+
|
31
|
+
characters = client.get_characters
|
32
|
+
|
33
|
+
characters.map(&:name)
|
34
|
+
# => ["赤城 あんな", "赤井 めが姉ぇ", "青葉 りんか", "だいあ", "ドロシー・ウェスト", "ファルル", "ガァルル", "北条 コスモ", "北条 そふぃ", "ジャニス", "ジュリィ", "じゅのん", "金森 まりあ", "かのん", "黄木 あじみ", "黒川 すず", "黒須 あろま", "レオナ・ウェスト", "真中 らぁら", "真中 のん", "緑川 さら", "緑風 ふわり", "南 みれぃ", "萌黄 えも", "桃山 みらい", "鍋島 ちゃん子", "七星 あいら", "虹ノ咲 だいあ", "ぴのん", "紫藤 める", "紫京院 ひびき", "白玉 みかん", "白鳥 アンジュ", "太陽 ペッパー", "東堂 シオン", "月川 ちり"]
|
35
|
+
|
36
|
+
characters[0]
|
37
|
+
# => #<Prismdb::Response _key="akagi_anna" birthday="7月6日" blood_type="O型" cv="芹澤優" favorite_brand="dolly_waltz" favorite_food="紅茶" height=147 name="赤城 あんな" name_kana="あかぎ あんな" type="ラブリー">
|
38
|
+
|
39
|
+
manaka_laala = client.find_character("manaka_laala")
|
40
|
+
# => #<Prismdb::Response birthday="11月20日" blood_type="O型" charm="ラブリー" cv="茜屋日海夏" favorite_brand="twinkle_ribbon" favorite_food="駄菓子" memberOf="solami_smile" name="真中 らぁら" name_kana="まなか らぁら" performerIn="pripara_50_dream_parade">
|
41
|
+
|
42
|
+
episodes = client.get_episodes
|
43
|
+
episodes[0]
|
44
|
+
# => #<Prismdb::Response _key="ad_1" episodeOfSeries="ad" lives=#<Hashie::Array ["ad_1_you_may_dream"]> サブタイトル="スタア誕生!" 放送日(TXN)="11/4/9" 演出="京極尚彦" 絵コンテ="青葉譲" 脚本="赤尾でこ" 話数=1>
|
45
|
+
|
46
|
+
pripara_1 = client.find_episode("pripara_1")
|
47
|
+
# => #<Prismdb::Response episodeOfSeries="pripara" lives=#<Hashie::Array ["pripara_1_make_it"]> アニメーション演出="Na Ki Chual" サブタイトル="アイドル始めちゃいました!" ストーリーボード="Sung Won Yong" 作画監修="森友宏樹" 放送日(TXN)="2014/7/5" 演出="徳本善信" 絵コンテ="森脇真琴" 脚本="土屋理敬" 話数=1>
|
48
|
+
|
49
|
+
songs = client.get_songs
|
50
|
+
songs[0]
|
51
|
+
# => #<Prismdb::Response _key="accha_koccha_game" lives=#<Hashie::Array []> name="あっちゃこっちゃゲーム" name_kana="あっちゃこっちゃげーむ">
|
52
|
+
|
53
|
+
make_it = client.find_song("make_it")
|
54
|
+
# => #<Prismdb::Response lives=#<Hashie::Array ["pripara_135_make_it", "pripara_1_make_it", "pripara_2_make_it", "pripara_37_make_it", "pripara_3_make_it", "pripara_4_make_it", "pripara_5_make_it", "pripara_63_make_it", "pripara_9_make_it"]> name="Make it!" name_kana="めいくいっと">
|
55
|
+
|
56
|
+
lives = client.get_lives
|
57
|
+
lives[0]
|
58
|
+
# => #<Prismdb::Response _key="ad_1_you_may_dream" liveOfEpisode="ad_1" performer="aira_and_rizumu" songPerformed="you_may_dream">
|
59
|
+
|
60
|
+
pripara_1_make_it = client.find_live("pripara_1_make_it")
|
61
|
+
# => #<Prismdb::Response liveOfEpisode="pripara_1" performer="laala_and_mirei" songPerformed="make_it">
|
62
|
+
|
63
|
+
series = client.get_series
|
64
|
+
series[0]
|
65
|
+
# => #<Prismdb::Response _key="ad" episodes=#<Hashie::Array ["ad_1", "ad_10", "ad_11", "ad_12", "ad_13", "ad_14", "ad_15", "ad_16", "ad_17", "ad_18", "ad_19", "ad_2", "ad_20", "ad_21", "ad_22", "ad_23", "ad_24", "ad_25", "ad_26", "ad_27", "ad_28", "ad_29", "ad_3", "ad_30", "ad_31", "ad_32", "ad_33", "ad_34", "ad_35", "ad_36", "ad_37", "ad_38", "ad_39", "ad_4", "ad_40", "ad_41", "ad_42", "ad_43", "ad_44", "ad_45", "ad_46", "ad_47", "ad_48", "ad_49", "ad_5", "ad_50", "ad_51", "ad_6", "ad_7", "ad_8", "ad_9"]> タイトル="プリティーリズム・オーロラドリーム">
|
66
|
+
|
67
|
+
series.map{ |h| h["タイトル"] }
|
68
|
+
# => ["プリティーリズム・オーロラドリーム", "プリティーリズム・ディアマイフューチャー", "アイドルタイムプリパラ", "キラッとプリ☆チャン", "プリパラ", "プリティーリズム・レインボーライブ"]
|
69
|
+
|
70
|
+
pripara = client.find_series("pripara")
|
71
|
+
# => #<Prismdb::Response episodes=#<Hashie::Array ["pripara_1", "pripara_10", "pripara_100", "pripara_101", "pripara_102", "pripara_103", "pripara_104", "pripara_105", "pripara_106", "pripara_107", "pripara_108", "pripara_109", "pripara_11", "pripara_110", "pripara_111", "pripara_112", "pripara_113", "pripara_114", "pripara_115", "pripara_116", "pripara_117", "pripara_118", "pripara_119", "pripara_12", "pripara_120", "pripara_121", "pripara_122", "pripara_123", "pripara_124", "pripara_125", "pripara_126", "pripara_127", "pripara_128", "pripara_129", "pripara_13", "pripara_130", "pripara_131", "pripara_132", "pripara_133", "pripara_134", "pripara_135", "pripara_136", "pripara_137", "pripara_138", "pripara_139", "pripara_14", "pripara_140", "pripara_15", "pripara_16", "pripara_17", "pripara_18", "pripara_19", "pripara_2", "pripara_20", "pripara_21", "pripara_22", "pripara_23", "pripara_24", "pripara_25", "pripara_26", "pripara_27", "pripara_28", "pripara_29", "pripara_3", "pripara_30", "pripara_31", "pripara_32", "pripara_33", "pripara_34", "pripara_35", "pripara_36", "pripara_37", "pripara_38", "pripara_39", "pripara_4", "pripara_40", "pripara_41", "pripara_42", "pripara_43", "pripara_44", "pripara_45", "pripara_46", "pripara_47", "pripara_48", "pripara_49", "pripara_5", "pripara_50", "pripara_51", "pripara_52", "pripara_53", "pripara_54", "pripara_55", "pripara_56", "pripara_57", "pripara_58", "pripara_59", "pripara_6", "pripara_60", "pripara_61", "pripara_62", "pripara_63", "pripara_64", "pripara_65", "pripara_66", "pripara_67", "pripara_68", "pripara_69", "pripara_7", "pripara_70", "pripara_71", "pripara_72", "pripara_73", "pripara_74", "pripara_75", "pripara_76", "pripara_77", "pripara_78", "pripara_79", "pripara_8", "pripara_80", "pripara_81", "pripara_82", "pripara_83", "pripara_84", "pripara_85", "pripara_86", "pripara_87", "pripara_88", "pripara_89", "pripara_9", "pripara_90", "pripara_91", "pripara_92", "pripara_93", "pripara_94", "pripara_95", "pripara_96", "pripara_97", "pripara_98", "pripara_99"]> タイトル="プリパラ">
|
72
|
+
```
|
73
|
+
|
74
|
+
All methods are followings
|
75
|
+
|
76
|
+
https://www.rubydoc.info/gems/prismdb
|
77
|
+
|
78
|
+
## Development
|
79
|
+
|
80
|
+
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.
|
81
|
+
|
82
|
+
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 tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
83
|
+
|
84
|
+
## Contributing
|
85
|
+
|
86
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/prismdb.
|
87
|
+
|
88
|
+
|
89
|
+
## License
|
90
|
+
|
91
|
+
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
data/Rakefile
ADDED
data/bin/console
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "bundler/setup"
|
4
|
+
require "prismdb"
|
5
|
+
|
6
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
7
|
+
# with your gem easier. You can also use a different console, if you like.
|
8
|
+
|
9
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
10
|
+
# require "pry"
|
11
|
+
# Pry.start
|
12
|
+
|
13
|
+
require "irb"
|
14
|
+
IRB.start(__FILE__)
|
data/bin/setup
ADDED
data/lib/prismdb.rb
ADDED
@@ -0,0 +1,16 @@
|
|
1
|
+
require "prismdb/version"
|
2
|
+
require "faraday"
|
3
|
+
require "faraday_middleware"
|
4
|
+
|
5
|
+
module Prismdb
|
6
|
+
autoload :Client, "prismdb/client"
|
7
|
+
autoload :Configuration, "prismdb/configuration"
|
8
|
+
autoload :Response, "prismdb/response"
|
9
|
+
|
10
|
+
class Error < StandardError; end
|
11
|
+
|
12
|
+
# @return [Prismdb::Configuration]
|
13
|
+
def self.config
|
14
|
+
@config ||= Configuration.new
|
15
|
+
end
|
16
|
+
end
|
@@ -0,0 +1,103 @@
|
|
1
|
+
module Prismdb
|
2
|
+
class Client
|
3
|
+
# @return [Array<Prismdb::Response>]
|
4
|
+
def get_characters
|
5
|
+
with_error_handling do
|
6
|
+
connection.get("/api/character").body["results"]
|
7
|
+
end
|
8
|
+
end
|
9
|
+
|
10
|
+
# @param key [String]
|
11
|
+
#
|
12
|
+
# @return [Prismdb::Response]
|
13
|
+
def find_character(key)
|
14
|
+
with_error_handling do
|
15
|
+
connection.get("/api/character/#{key}").body
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
# @return [Array<Prismdb::Response>]
|
20
|
+
def get_episodes
|
21
|
+
with_error_handling do
|
22
|
+
connection.get("/api/episode").body["results"]
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
# @param key [String]
|
27
|
+
#
|
28
|
+
# @return [Prismdb::Response]
|
29
|
+
def find_episode(key)
|
30
|
+
with_error_handling do
|
31
|
+
connection.get("/api/episode/#{key}").body
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
# @return [Array<Prismdb::Response>]
|
36
|
+
def get_songs
|
37
|
+
with_error_handling do
|
38
|
+
connection.get("/api/song").body["results"]
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
# @param key [String]
|
43
|
+
#
|
44
|
+
# @return [Prismdb::Response]
|
45
|
+
def find_song(key)
|
46
|
+
with_error_handling do
|
47
|
+
connection.get("/api/song/#{key}").body
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
51
|
+
# @return [Array<Prismdb::Response>]
|
52
|
+
def get_lives
|
53
|
+
with_error_handling do
|
54
|
+
connection.get("/api/live").body["results"]
|
55
|
+
end
|
56
|
+
end
|
57
|
+
|
58
|
+
# @param key [String]
|
59
|
+
#
|
60
|
+
# @return [Prismdb::Response]
|
61
|
+
def find_live(key)
|
62
|
+
with_error_handling do
|
63
|
+
connection.get("/api/live/#{key}").body
|
64
|
+
end
|
65
|
+
end
|
66
|
+
|
67
|
+
# @return [Array<Prismdb::Response>]
|
68
|
+
def get_series
|
69
|
+
with_error_handling do
|
70
|
+
connection.get("/api/series").body["results"]
|
71
|
+
end
|
72
|
+
end
|
73
|
+
|
74
|
+
# @param key [String]
|
75
|
+
#
|
76
|
+
# @return [Prismdb::Response]
|
77
|
+
def find_series(key)
|
78
|
+
with_error_handling do
|
79
|
+
connection.get("/api/series/#{key}").body
|
80
|
+
end
|
81
|
+
end
|
82
|
+
|
83
|
+
private
|
84
|
+
|
85
|
+
# @return [Faraday::Connection]
|
86
|
+
def connection
|
87
|
+
Faraday.new(url: Prismdb.config.api_endpoint) do |conn|
|
88
|
+
conn.request :json
|
89
|
+
conn.response :mashify, mash_class: Prismdb::Response
|
90
|
+
conn.response :json
|
91
|
+
conn.response :raise_error
|
92
|
+
|
93
|
+
conn.adapter Faraday.default_adapter
|
94
|
+
end
|
95
|
+
end
|
96
|
+
|
97
|
+
def with_error_handling
|
98
|
+
yield
|
99
|
+
rescue Faraday::ClientError, Faraday::ServerError => _error
|
100
|
+
raise Prismdb::Error
|
101
|
+
end
|
102
|
+
end
|
103
|
+
end
|
data/prismdb.gemspec
ADDED
@@ -0,0 +1,31 @@
|
|
1
|
+
require_relative 'lib/prismdb/version'
|
2
|
+
|
3
|
+
Gem::Specification.new do |spec|
|
4
|
+
spec.name = "prismdb"
|
5
|
+
spec.version = Prismdb::VERSION
|
6
|
+
spec.authors = ["sue445"]
|
7
|
+
spec.email = ["sue445@sue445.net"]
|
8
|
+
|
9
|
+
spec.summary = %q{PrismDB API client for ruby}
|
10
|
+
spec.description = %q{PrismDB API client for ruby}
|
11
|
+
spec.homepage = "https://github.com/sue445/prismdb-ruby"
|
12
|
+
spec.license = "MIT"
|
13
|
+
spec.required_ruby_version = Gem::Requirement.new(">= 2.5.0")
|
14
|
+
|
15
|
+
spec.metadata["homepage_uri"] = spec.homepage
|
16
|
+
spec.metadata["source_code_uri"] = "https://github.com/sue445/prismdb-ruby"
|
17
|
+
spec.metadata["changelog_uri"] = "https://github.com/sue445/prismdb-ruby/blob/master/CHANGELOG.md"
|
18
|
+
|
19
|
+
# Specify which files should be added to the gem when it is released.
|
20
|
+
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
|
21
|
+
spec.files = Dir.chdir(File.expand_path('..', __FILE__)) do
|
22
|
+
`git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
23
|
+
end
|
24
|
+
spec.bindir = "exe"
|
25
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
26
|
+
spec.require_paths = ["lib"]
|
27
|
+
|
28
|
+
spec.add_dependency "faraday", ">= 1.0.0"
|
29
|
+
spec.add_dependency "faraday_middleware"
|
30
|
+
spec.add_dependency "hashie"
|
31
|
+
end
|
metadata
ADDED
@@ -0,0 +1,105 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: prismdb
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- sue445
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2020-03-15 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: faraday
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: 1.0.0
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: 1.0.0
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: faraday_middleware
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: hashie
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ">="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :runtime
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
description: PrismDB API client for ruby
|
56
|
+
email:
|
57
|
+
- sue445@sue445.net
|
58
|
+
executables: []
|
59
|
+
extensions: []
|
60
|
+
extra_rdoc_files: []
|
61
|
+
files:
|
62
|
+
- ".coveralls.yml"
|
63
|
+
- ".github/workflows/test.yml"
|
64
|
+
- ".gitignore"
|
65
|
+
- ".rspec"
|
66
|
+
- CHANGELOG.md
|
67
|
+
- Gemfile
|
68
|
+
- LICENSE.txt
|
69
|
+
- README.md
|
70
|
+
- Rakefile
|
71
|
+
- bin/console
|
72
|
+
- bin/setup
|
73
|
+
- lib/prismdb.rb
|
74
|
+
- lib/prismdb/client.rb
|
75
|
+
- lib/prismdb/configuration.rb
|
76
|
+
- lib/prismdb/response.rb
|
77
|
+
- lib/prismdb/version.rb
|
78
|
+
- prismdb.gemspec
|
79
|
+
homepage: https://github.com/sue445/prismdb-ruby
|
80
|
+
licenses:
|
81
|
+
- MIT
|
82
|
+
metadata:
|
83
|
+
homepage_uri: https://github.com/sue445/prismdb-ruby
|
84
|
+
source_code_uri: https://github.com/sue445/prismdb-ruby
|
85
|
+
changelog_uri: https://github.com/sue445/prismdb-ruby/blob/master/CHANGELOG.md
|
86
|
+
post_install_message:
|
87
|
+
rdoc_options: []
|
88
|
+
require_paths:
|
89
|
+
- lib
|
90
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
91
|
+
requirements:
|
92
|
+
- - ">="
|
93
|
+
- !ruby/object:Gem::Version
|
94
|
+
version: 2.5.0
|
95
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
96
|
+
requirements:
|
97
|
+
- - ">="
|
98
|
+
- !ruby/object:Gem::Version
|
99
|
+
version: '0'
|
100
|
+
requirements: []
|
101
|
+
rubygems_version: 3.1.2
|
102
|
+
signing_key:
|
103
|
+
specification_version: 4
|
104
|
+
summary: PrismDB API client for ruby
|
105
|
+
test_files: []
|