j_sdk 0.1.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 +7 -0
- data/.DS_Store +0 -0
- data/.rspec +3 -0
- data/CHANGELOG.md +9 -0
- data/Gemfile +16 -0
- data/Gemfile.lock +49 -0
- data/LICENSE.txt +21 -0
- data/README.md +37 -0
- data/Rakefile +8 -0
- data/fixtures/cassettes/get_movie-5cd95395de30eff6ebccde5b.yml +69 -0
- data/fixtures/cassettes/get_movies.yml +77 -0
- data/fixtures/cassettes/get_quotes-5cd95395de30eff6ebccde56.yml +136 -0
- data/fixtures/cassettes/get_quotes-5cd95395de30eff6ebccde5b.yml +147 -0
- data/j_sdk.gemspec +39 -0
- data/lib/j_sdk/lotr.rb +77 -0
- data/lib/j_sdk/movie.rb +21 -0
- data/lib/j_sdk/quote.rb +13 -0
- data/lib/j_sdk/version.rb +5 -0
- data/lib/j_sdk.rb +14 -0
- data/sig/j_sdk.rbs +4 -0
- metadata +65 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: d168ec10156a97978b49d016c484f316bce199f0b95602b0ee5c454324e04e49
|
4
|
+
data.tar.gz: 9b8afc88ecda3f6ac45e8e6785680244f433bd0dca5b4e2a70be8ea481fddd5b
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 8edf8be9c373f83b6e91f6f05edb8e6b90bb366304097ae40d333e08d8a2dcb64d5e57e9e3d1727733d85c0beaf8953909f0706d9db26fa69ab3f86ae38ec44a
|
7
|
+
data.tar.gz: e846d1205c3a0340674e68fb13e9f42e8450e24ac94c34a3a64a43695ad58a53f4f32091fca4992c6edced98a6036d342c50d650b99f4da4181ab7a1c39cc86d
|
data/.DS_Store
ADDED
Binary file
|
data/.rspec
ADDED
data/CHANGELOG.md
ADDED
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,49 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
j_sdk (0.1.1)
|
5
|
+
|
6
|
+
GEM
|
7
|
+
remote: https://rubygems.org/
|
8
|
+
specs:
|
9
|
+
addressable (2.8.1)
|
10
|
+
public_suffix (>= 2.0.2, < 6.0)
|
11
|
+
crack (0.4.5)
|
12
|
+
rexml
|
13
|
+
diff-lcs (1.5.0)
|
14
|
+
hashdiff (1.0.1)
|
15
|
+
public_suffix (5.0.1)
|
16
|
+
rake (13.0.6)
|
17
|
+
rexml (3.2.5)
|
18
|
+
rspec (3.12.0)
|
19
|
+
rspec-core (~> 3.12.0)
|
20
|
+
rspec-expectations (~> 3.12.0)
|
21
|
+
rspec-mocks (~> 3.12.0)
|
22
|
+
rspec-core (3.12.1)
|
23
|
+
rspec-support (~> 3.12.0)
|
24
|
+
rspec-expectations (3.12.2)
|
25
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
26
|
+
rspec-support (~> 3.12.0)
|
27
|
+
rspec-mocks (3.12.3)
|
28
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
29
|
+
rspec-support (~> 3.12.0)
|
30
|
+
rspec-support (3.12.0)
|
31
|
+
vcr (6.1.0)
|
32
|
+
webmock (3.18.1)
|
33
|
+
addressable (>= 2.8.0)
|
34
|
+
crack (>= 0.3.2)
|
35
|
+
hashdiff (>= 0.4.0, < 2.0.0)
|
36
|
+
|
37
|
+
PLATFORMS
|
38
|
+
x86_64-darwin-20
|
39
|
+
x86_64-linux
|
40
|
+
|
41
|
+
DEPENDENCIES
|
42
|
+
j_sdk!
|
43
|
+
rake (~> 13.0)
|
44
|
+
rspec (~> 3.0)
|
45
|
+
vcr
|
46
|
+
webmock
|
47
|
+
|
48
|
+
BUNDLED WITH
|
49
|
+
2.3.7
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2023 Jose M. Tobar
|
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,37 @@
|
|
1
|
+
# JSdk
|
2
|
+
|
3
|
+
A Ruby Gem that can be used to get information from the LOTR API found [here](https://the-one-api.dev/).
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
Add this line to your application's Gemfile:
|
8
|
+
|
9
|
+
```ruby
|
10
|
+
gem 'j_sdk'
|
11
|
+
```
|
12
|
+
|
13
|
+
And then execute:
|
14
|
+
|
15
|
+
$ bundle install
|
16
|
+
|
17
|
+
Or install it yourself as:
|
18
|
+
|
19
|
+
$ gem install j_sdk
|
20
|
+
|
21
|
+
## Usage
|
22
|
+
|
23
|
+
TODO: Write usage instructions here
|
24
|
+
|
25
|
+
## Development
|
26
|
+
|
27
|
+
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.
|
28
|
+
|
29
|
+
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).
|
30
|
+
|
31
|
+
## Contributing
|
32
|
+
|
33
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/ilovemysillybanana/j_sdk.
|
34
|
+
|
35
|
+
## License
|
36
|
+
|
37
|
+
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
data/Rakefile
ADDED
@@ -0,0 +1,69 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: get
|
5
|
+
uri: https://the-one-api.dev/v2/movie/5cd95395de30eff6ebccde5b
|
6
|
+
body:
|
7
|
+
encoding: US-ASCII
|
8
|
+
string: ''
|
9
|
+
headers:
|
10
|
+
Authorization:
|
11
|
+
- Bearer OW4rssr_irBabV-4Avys
|
12
|
+
Accept-Encoding:
|
13
|
+
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
14
|
+
Accept:
|
15
|
+
- "*/*"
|
16
|
+
User-Agent:
|
17
|
+
- Ruby
|
18
|
+
Host:
|
19
|
+
- the-one-api.dev
|
20
|
+
response:
|
21
|
+
status:
|
22
|
+
code: 200
|
23
|
+
message: OK
|
24
|
+
headers:
|
25
|
+
Date:
|
26
|
+
- Sun, 12 Mar 2023 23:04:27 GMT
|
27
|
+
Server:
|
28
|
+
- Apache/2.4.41 (Ubuntu)
|
29
|
+
Content-Security-Policy:
|
30
|
+
- 'default-src ''self'';base-uri ''self'';block-all-mixed-content;font-src ''self''
|
31
|
+
https: data:;frame-ancestors ''self'';img-src ''self'' data:;object-src ''none'';script-src
|
32
|
+
''self'';script-src-attr ''none'';style-src ''self'' https: ''unsafe-inline'';upgrade-insecure-requests'
|
33
|
+
X-Dns-Prefetch-Control:
|
34
|
+
- 'off'
|
35
|
+
Expect-Ct:
|
36
|
+
- max-age=0
|
37
|
+
X-Frame-Options:
|
38
|
+
- SAMEORIGIN
|
39
|
+
Strict-Transport-Security:
|
40
|
+
- max-age=15552000; includeSubDomains
|
41
|
+
X-Download-Options:
|
42
|
+
- noopen
|
43
|
+
X-Content-Type-Options:
|
44
|
+
- nosniff
|
45
|
+
X-Permitted-Cross-Domain-Policies:
|
46
|
+
- none
|
47
|
+
Referrer-Policy:
|
48
|
+
- no-referrer
|
49
|
+
X-Xss-Protection:
|
50
|
+
- '0'
|
51
|
+
Access-Control-Allow-Origin:
|
52
|
+
- "*"
|
53
|
+
X-Ratelimit-Limit:
|
54
|
+
- '100'
|
55
|
+
X-Ratelimit-Remaining:
|
56
|
+
- '84'
|
57
|
+
X-Ratelimit-Reset:
|
58
|
+
- '1678662397'
|
59
|
+
Content-Type:
|
60
|
+
- application/json; charset=utf-8
|
61
|
+
Content-Length:
|
62
|
+
- '274'
|
63
|
+
Etag:
|
64
|
+
- W/"112-NVaVyMNdyPCxy2GfDss7/ZeeuMQ"
|
65
|
+
body:
|
66
|
+
encoding: UTF-8
|
67
|
+
string: '{"docs":[{"_id":"5cd95395de30eff6ebccde5b","name":"The Two Towers","runtimeInMinutes":179,"budgetInMillions":94,"boxOfficeRevenueInMillions":926,"academyAwardNominations":6,"academyAwardWins":2,"rottenTomatoesScore":96}],"total":1,"limit":1000,"offset":0,"page":1,"pages":1}'
|
68
|
+
recorded_at: Sun, 12 Mar 2023 23:04:27 GMT
|
69
|
+
recorded_with: VCR 6.1.0
|
@@ -0,0 +1,77 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: get
|
5
|
+
uri: https://the-one-api.dev/v2/movie
|
6
|
+
body:
|
7
|
+
encoding: US-ASCII
|
8
|
+
string: ''
|
9
|
+
headers:
|
10
|
+
Authorization:
|
11
|
+
- Bearer OW4rssr_irBabV-4Avys
|
12
|
+
Accept-Encoding:
|
13
|
+
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
14
|
+
Accept:
|
15
|
+
- "*/*"
|
16
|
+
User-Agent:
|
17
|
+
- Ruby
|
18
|
+
Host:
|
19
|
+
- the-one-api.dev
|
20
|
+
response:
|
21
|
+
status:
|
22
|
+
code: 200
|
23
|
+
message: OK
|
24
|
+
headers:
|
25
|
+
Date:
|
26
|
+
- Sun, 12 Mar 2023 23:04:26 GMT
|
27
|
+
Server:
|
28
|
+
- Apache/2.4.41 (Ubuntu)
|
29
|
+
Content-Security-Policy:
|
30
|
+
- 'default-src ''self'';base-uri ''self'';block-all-mixed-content;font-src ''self''
|
31
|
+
https: data:;frame-ancestors ''self'';img-src ''self'' data:;object-src ''none'';script-src
|
32
|
+
''self'';script-src-attr ''none'';style-src ''self'' https: ''unsafe-inline'';upgrade-insecure-requests'
|
33
|
+
X-Dns-Prefetch-Control:
|
34
|
+
- 'off'
|
35
|
+
Expect-Ct:
|
36
|
+
- max-age=0
|
37
|
+
X-Frame-Options:
|
38
|
+
- SAMEORIGIN
|
39
|
+
Strict-Transport-Security:
|
40
|
+
- max-age=15552000; includeSubDomains
|
41
|
+
X-Download-Options:
|
42
|
+
- noopen
|
43
|
+
X-Content-Type-Options:
|
44
|
+
- nosniff
|
45
|
+
X-Permitted-Cross-Domain-Policies:
|
46
|
+
- none
|
47
|
+
Referrer-Policy:
|
48
|
+
- no-referrer
|
49
|
+
X-Xss-Protection:
|
50
|
+
- '0'
|
51
|
+
Access-Control-Allow-Origin:
|
52
|
+
- "*"
|
53
|
+
X-Ratelimit-Limit:
|
54
|
+
- '100'
|
55
|
+
X-Ratelimit-Remaining:
|
56
|
+
- '85'
|
57
|
+
X-Ratelimit-Reset:
|
58
|
+
- '1678662397'
|
59
|
+
Content-Type:
|
60
|
+
- application/json; charset=utf-8
|
61
|
+
Content-Length:
|
62
|
+
- '1847'
|
63
|
+
Etag:
|
64
|
+
- W/"737-FtnbVAMtM2Np7AQquxcGvrlVqbI"
|
65
|
+
body:
|
66
|
+
encoding: UTF-8
|
67
|
+
string: '{"docs":[{"_id":"5cd95395de30eff6ebccde56","name":"The Lord of the
|
68
|
+
Rings Series","runtimeInMinutes":558,"budgetInMillions":281,"boxOfficeRevenueInMillions":2917,"academyAwardNominations":30,"academyAwardWins":17,"rottenTomatoesScore":94},{"_id":"5cd95395de30eff6ebccde57","name":"The
|
69
|
+
Hobbit Series","runtimeInMinutes":462,"budgetInMillions":675,"boxOfficeRevenueInMillions":2932,"academyAwardNominations":7,"academyAwardWins":1,"rottenTomatoesScore":66.33333333},{"_id":"5cd95395de30eff6ebccde58","name":"The
|
70
|
+
Unexpected Journey","runtimeInMinutes":169,"budgetInMillions":200,"boxOfficeRevenueInMillions":1021,"academyAwardNominations":3,"academyAwardWins":1,"rottenTomatoesScore":64},{"_id":"5cd95395de30eff6ebccde59","name":"The
|
71
|
+
Desolation of Smaug","runtimeInMinutes":161,"budgetInMillions":217,"boxOfficeRevenueInMillions":958.4,"academyAwardNominations":3,"academyAwardWins":0,"rottenTomatoesScore":75},{"_id":"5cd95395de30eff6ebccde5a","name":"The
|
72
|
+
Battle of the Five Armies","runtimeInMinutes":144,"budgetInMillions":250,"boxOfficeRevenueInMillions":956,"academyAwardNominations":1,"academyAwardWins":0,"rottenTomatoesScore":60},{"_id":"5cd95395de30eff6ebccde5b","name":"The
|
73
|
+
Two Towers","runtimeInMinutes":179,"budgetInMillions":94,"boxOfficeRevenueInMillions":926,"academyAwardNominations":6,"academyAwardWins":2,"rottenTomatoesScore":96},{"_id":"5cd95395de30eff6ebccde5c","name":"The
|
74
|
+
Fellowship of the Ring","runtimeInMinutes":178,"budgetInMillions":93,"boxOfficeRevenueInMillions":871.5,"academyAwardNominations":13,"academyAwardWins":4,"rottenTomatoesScore":91},{"_id":"5cd95395de30eff6ebccde5d","name":"The
|
75
|
+
Return of the King","runtimeInMinutes":201,"budgetInMillions":94,"boxOfficeRevenueInMillions":1120,"academyAwardNominations":11,"academyAwardWins":11,"rottenTomatoesScore":95}],"total":8,"limit":1000,"offset":0,"page":1,"pages":1}'
|
76
|
+
recorded_at: Sun, 12 Mar 2023 23:04:26 GMT
|
77
|
+
recorded_with: VCR 6.1.0
|
@@ -0,0 +1,136 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: get
|
5
|
+
uri: https://the-one-api.dev/v2/movie/5cd95395de30eff6ebccde56
|
6
|
+
body:
|
7
|
+
encoding: US-ASCII
|
8
|
+
string: ''
|
9
|
+
headers:
|
10
|
+
Authorization:
|
11
|
+
- Bearer OW4rssr_irBabV-4Avys
|
12
|
+
Accept-Encoding:
|
13
|
+
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
14
|
+
Accept:
|
15
|
+
- "*/*"
|
16
|
+
User-Agent:
|
17
|
+
- Ruby
|
18
|
+
Host:
|
19
|
+
- the-one-api.dev
|
20
|
+
response:
|
21
|
+
status:
|
22
|
+
code: 200
|
23
|
+
message: OK
|
24
|
+
headers:
|
25
|
+
Date:
|
26
|
+
- Sun, 12 Mar 2023 23:25:19 GMT
|
27
|
+
Server:
|
28
|
+
- Apache/2.4.41 (Ubuntu)
|
29
|
+
Content-Security-Policy:
|
30
|
+
- 'default-src ''self'';base-uri ''self'';block-all-mixed-content;font-src ''self''
|
31
|
+
https: data:;frame-ancestors ''self'';img-src ''self'' data:;object-src ''none'';script-src
|
32
|
+
''self'';script-src-attr ''none'';style-src ''self'' https: ''unsafe-inline'';upgrade-insecure-requests'
|
33
|
+
X-Dns-Prefetch-Control:
|
34
|
+
- 'off'
|
35
|
+
Expect-Ct:
|
36
|
+
- max-age=0
|
37
|
+
X-Frame-Options:
|
38
|
+
- SAMEORIGIN
|
39
|
+
Strict-Transport-Security:
|
40
|
+
- max-age=15552000; includeSubDomains
|
41
|
+
X-Download-Options:
|
42
|
+
- noopen
|
43
|
+
X-Content-Type-Options:
|
44
|
+
- nosniff
|
45
|
+
X-Permitted-Cross-Domain-Policies:
|
46
|
+
- none
|
47
|
+
Referrer-Policy:
|
48
|
+
- no-referrer
|
49
|
+
X-Xss-Protection:
|
50
|
+
- '0'
|
51
|
+
Access-Control-Allow-Origin:
|
52
|
+
- "*"
|
53
|
+
X-Ratelimit-Limit:
|
54
|
+
- '100'
|
55
|
+
X-Ratelimit-Remaining:
|
56
|
+
- '74'
|
57
|
+
X-Ratelimit-Reset:
|
58
|
+
- '1678663597'
|
59
|
+
Content-Type:
|
60
|
+
- application/json; charset=utf-8
|
61
|
+
Content-Length:
|
62
|
+
- '292'
|
63
|
+
Etag:
|
64
|
+
- W/"124-rMpzkQgACxn6GAbybMj5DfZZN7A"
|
65
|
+
body:
|
66
|
+
encoding: UTF-8
|
67
|
+
string: '{"docs":[{"_id":"5cd95395de30eff6ebccde56","name":"The Lord of the
|
68
|
+
Rings Series","runtimeInMinutes":558,"budgetInMillions":281,"boxOfficeRevenueInMillions":2917,"academyAwardNominations":30,"academyAwardWins":17,"rottenTomatoesScore":94}],"total":1,"limit":1000,"offset":0,"page":1,"pages":1}'
|
69
|
+
recorded_at: Sun, 12 Mar 2023 23:25:19 GMT
|
70
|
+
- request:
|
71
|
+
method: get
|
72
|
+
uri: https://the-one-api.dev/v2/movie/5cd95395de30eff6ebccde56/quote?limit=10
|
73
|
+
body:
|
74
|
+
encoding: US-ASCII
|
75
|
+
string: ''
|
76
|
+
headers:
|
77
|
+
Authorization:
|
78
|
+
- Bearer OW4rssr_irBabV-4Avys
|
79
|
+
Accept-Encoding:
|
80
|
+
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
81
|
+
Accept:
|
82
|
+
- "*/*"
|
83
|
+
User-Agent:
|
84
|
+
- Ruby
|
85
|
+
Host:
|
86
|
+
- the-one-api.dev
|
87
|
+
response:
|
88
|
+
status:
|
89
|
+
code: 200
|
90
|
+
message: OK
|
91
|
+
headers:
|
92
|
+
Date:
|
93
|
+
- Sun, 12 Mar 2023 23:25:19 GMT
|
94
|
+
Server:
|
95
|
+
- Apache/2.4.41 (Ubuntu)
|
96
|
+
Content-Security-Policy:
|
97
|
+
- 'default-src ''self'';base-uri ''self'';block-all-mixed-content;font-src ''self''
|
98
|
+
https: data:;frame-ancestors ''self'';img-src ''self'' data:;object-src ''none'';script-src
|
99
|
+
''self'';script-src-attr ''none'';style-src ''self'' https: ''unsafe-inline'';upgrade-insecure-requests'
|
100
|
+
X-Dns-Prefetch-Control:
|
101
|
+
- 'off'
|
102
|
+
Expect-Ct:
|
103
|
+
- max-age=0
|
104
|
+
X-Frame-Options:
|
105
|
+
- SAMEORIGIN
|
106
|
+
Strict-Transport-Security:
|
107
|
+
- max-age=15552000; includeSubDomains
|
108
|
+
X-Download-Options:
|
109
|
+
- noopen
|
110
|
+
X-Content-Type-Options:
|
111
|
+
- nosniff
|
112
|
+
X-Permitted-Cross-Domain-Policies:
|
113
|
+
- none
|
114
|
+
Referrer-Policy:
|
115
|
+
- no-referrer
|
116
|
+
X-Xss-Protection:
|
117
|
+
- '0'
|
118
|
+
Access-Control-Allow-Origin:
|
119
|
+
- "*"
|
120
|
+
X-Ratelimit-Limit:
|
121
|
+
- '100'
|
122
|
+
X-Ratelimit-Remaining:
|
123
|
+
- '73'
|
124
|
+
X-Ratelimit-Reset:
|
125
|
+
- '1678663597'
|
126
|
+
Content-Type:
|
127
|
+
- application/json; charset=utf-8
|
128
|
+
Content-Length:
|
129
|
+
- '62'
|
130
|
+
Etag:
|
131
|
+
- W/"3e-F9HLY8bCvlnXIPS7lNMVq2JF/t8"
|
132
|
+
body:
|
133
|
+
encoding: UTF-8
|
134
|
+
string: '{"docs":[],"total":0,"limit":10,"offset":0,"page":1,"pages":1}'
|
135
|
+
recorded_at: Sun, 12 Mar 2023 23:25:19 GMT
|
136
|
+
recorded_with: VCR 6.1.0
|
@@ -0,0 +1,147 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: get
|
5
|
+
uri: https://the-one-api.dev/v2/movie/5cd95395de30eff6ebccde5b
|
6
|
+
body:
|
7
|
+
encoding: US-ASCII
|
8
|
+
string: ''
|
9
|
+
headers:
|
10
|
+
Authorization:
|
11
|
+
- Bearer OW4rssr_irBabV-4Avys
|
12
|
+
Accept-Encoding:
|
13
|
+
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
14
|
+
Accept:
|
15
|
+
- "*/*"
|
16
|
+
User-Agent:
|
17
|
+
- Ruby
|
18
|
+
Host:
|
19
|
+
- the-one-api.dev
|
20
|
+
response:
|
21
|
+
status:
|
22
|
+
code: 200
|
23
|
+
message: OK
|
24
|
+
headers:
|
25
|
+
Date:
|
26
|
+
- Sun, 12 Mar 2023 23:14:35 GMT
|
27
|
+
Server:
|
28
|
+
- Apache/2.4.41 (Ubuntu)
|
29
|
+
Content-Security-Policy:
|
30
|
+
- 'default-src ''self'';base-uri ''self'';block-all-mixed-content;font-src ''self''
|
31
|
+
https: data:;frame-ancestors ''self'';img-src ''self'' data:;object-src ''none'';script-src
|
32
|
+
''self'';script-src-attr ''none'';style-src ''self'' https: ''unsafe-inline'';upgrade-insecure-requests'
|
33
|
+
X-Dns-Prefetch-Control:
|
34
|
+
- 'off'
|
35
|
+
Expect-Ct:
|
36
|
+
- max-age=0
|
37
|
+
X-Frame-Options:
|
38
|
+
- SAMEORIGIN
|
39
|
+
Strict-Transport-Security:
|
40
|
+
- max-age=15552000; includeSubDomains
|
41
|
+
X-Download-Options:
|
42
|
+
- noopen
|
43
|
+
X-Content-Type-Options:
|
44
|
+
- nosniff
|
45
|
+
X-Permitted-Cross-Domain-Policies:
|
46
|
+
- none
|
47
|
+
Referrer-Policy:
|
48
|
+
- no-referrer
|
49
|
+
X-Xss-Protection:
|
50
|
+
- '0'
|
51
|
+
Access-Control-Allow-Origin:
|
52
|
+
- "*"
|
53
|
+
X-Ratelimit-Limit:
|
54
|
+
- '100'
|
55
|
+
X-Ratelimit-Remaining:
|
56
|
+
- '86'
|
57
|
+
X-Ratelimit-Reset:
|
58
|
+
- '1678662997'
|
59
|
+
Content-Type:
|
60
|
+
- application/json; charset=utf-8
|
61
|
+
Content-Length:
|
62
|
+
- '274'
|
63
|
+
Etag:
|
64
|
+
- W/"112-NVaVyMNdyPCxy2GfDss7/ZeeuMQ"
|
65
|
+
body:
|
66
|
+
encoding: UTF-8
|
67
|
+
string: '{"docs":[{"_id":"5cd95395de30eff6ebccde5b","name":"The Two Towers","runtimeInMinutes":179,"budgetInMillions":94,"boxOfficeRevenueInMillions":926,"academyAwardNominations":6,"academyAwardWins":2,"rottenTomatoesScore":96}],"total":1,"limit":1000,"offset":0,"page":1,"pages":1}'
|
68
|
+
recorded_at: Sun, 12 Mar 2023 23:14:35 GMT
|
69
|
+
- request:
|
70
|
+
method: get
|
71
|
+
uri: https://the-one-api.dev/v2/movie/5cd95395de30eff6ebccde5b/quote?limit=10
|
72
|
+
body:
|
73
|
+
encoding: US-ASCII
|
74
|
+
string: ''
|
75
|
+
headers:
|
76
|
+
Authorization:
|
77
|
+
- Bearer OW4rssr_irBabV-4Avys
|
78
|
+
Accept-Encoding:
|
79
|
+
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
80
|
+
Accept:
|
81
|
+
- "*/*"
|
82
|
+
User-Agent:
|
83
|
+
- Ruby
|
84
|
+
Host:
|
85
|
+
- the-one-api.dev
|
86
|
+
response:
|
87
|
+
status:
|
88
|
+
code: 200
|
89
|
+
message: OK
|
90
|
+
headers:
|
91
|
+
Date:
|
92
|
+
- Sun, 12 Mar 2023 23:14:36 GMT
|
93
|
+
Server:
|
94
|
+
- Apache/2.4.41 (Ubuntu)
|
95
|
+
Content-Security-Policy:
|
96
|
+
- 'default-src ''self'';base-uri ''self'';block-all-mixed-content;font-src ''self''
|
97
|
+
https: data:;frame-ancestors ''self'';img-src ''self'' data:;object-src ''none'';script-src
|
98
|
+
''self'';script-src-attr ''none'';style-src ''self'' https: ''unsafe-inline'';upgrade-insecure-requests'
|
99
|
+
X-Dns-Prefetch-Control:
|
100
|
+
- 'off'
|
101
|
+
Expect-Ct:
|
102
|
+
- max-age=0
|
103
|
+
X-Frame-Options:
|
104
|
+
- SAMEORIGIN
|
105
|
+
Strict-Transport-Security:
|
106
|
+
- max-age=15552000; includeSubDomains
|
107
|
+
X-Download-Options:
|
108
|
+
- noopen
|
109
|
+
X-Content-Type-Options:
|
110
|
+
- nosniff
|
111
|
+
X-Permitted-Cross-Domain-Policies:
|
112
|
+
- none
|
113
|
+
Referrer-Policy:
|
114
|
+
- no-referrer
|
115
|
+
X-Xss-Protection:
|
116
|
+
- '0'
|
117
|
+
Access-Control-Allow-Origin:
|
118
|
+
- "*"
|
119
|
+
X-Ratelimit-Limit:
|
120
|
+
- '100'
|
121
|
+
X-Ratelimit-Remaining:
|
122
|
+
- '85'
|
123
|
+
X-Ratelimit-Reset:
|
124
|
+
- '1678662997'
|
125
|
+
Content-Type:
|
126
|
+
- application/json; charset=utf-8
|
127
|
+
Content-Length:
|
128
|
+
- '2278'
|
129
|
+
Etag:
|
130
|
+
- W/"8e6-/jz+w/6xkbr0uryfeq4NPXI0yTw"
|
131
|
+
body:
|
132
|
+
encoding: UTF-8
|
133
|
+
string: '{"docs":[{"_id":"5cd96e05de30eff6ebcce9b8","dialog":"Sauron''s wrath
|
134
|
+
will be terrible, his retribution swift.","movie":"5cd95395de30eff6ebccde5b","character":"5cd99d4bde30eff6ebccfea0","id":"5cd96e05de30eff6ebcce9b8"},{"_id":"5cd96e05de30eff6ebcce9b9","dialog":"The
|
135
|
+
battle for Helm''s Deep is over. The battle for Middle-earth is about to begin.","movie":"5cd95395de30eff6ebccde5b","character":"5cd99d4bde30eff6ebccfea0","id":"5cd96e05de30eff6ebcce9b9"},{"_id":"5cd96e05de30eff6ebcce9ba","dialog":"All
|
136
|
+
our hopes now lie with two little Hobbits...","movie":"5cd95395de30eff6ebccde5b","character":"5cd99d4bde30eff6ebccfea0","id":"5cd96e05de30eff6ebcce9ba"},{"_id":"5cd96e05de30eff6ebcce9cb","dialog":"...somewhere
|
137
|
+
in the wilderness.","movie":"5cd95395de30eff6ebccde5b","character":"5cd99d4bde30eff6ebccfea0","id":"5cd96e05de30eff6ebcce9cb"},{"_id":"5cd96e05de30eff6ebcce9cc","dialog":"I
|
138
|
+
wonder if we''ll ever be put into songs or tales.","movie":"5cd95395de30eff6ebccde5b","character":"5cd99d4bde30eff6ebccfd0d","id":"5cd96e05de30eff6ebcce9cc"},{"_id":"5cd96e05de30eff6ebcce9cd","dialog":"What?","movie":"5cd95395de30eff6ebccde5b","character":"5cd99d4bde30eff6ebccfc15","id":"5cd96e05de30eff6ebcce9cd"},{"_id":"5cd96e05de30eff6ebcce9ce","dialog":"I
|
139
|
+
wonder if people will ever say, \"Let''s hear about Frodo and the Ring.\"
|
140
|
+
And they''ll say, \"Yes! That''s one of my favourite stories.\" \"Frodo was
|
141
|
+
really courageous, wasn''t he, Dad? \" \"Yes, my boy. The most famousest of
|
142
|
+
Hobbits. And that''s saying a lot.\"","movie":"5cd95395de30eff6ebccde5b","character":"5cd99d4bde30eff6ebccfd0d","id":"5cd96e05de30eff6ebcce9ce"},{"_id":"5cd96e05de30eff6ebcce9cf","dialog":"Well,
|
143
|
+
you''ve left out one of the chief characters: \"Samwise the Brave.\" I want
|
144
|
+
to hear more about Sam.","movie":"5cd95395de30eff6ebccde5b","character":"5cd99d4bde30eff6ebccfc15","id":"5cd96e05de30eff6ebcce9cf"},{"_id":"5cd96e05de30eff6ebcce9d0","dialog":"Frodo
|
145
|
+
wouldn''t have got far without Sam.","movie":"5cd95395de30eff6ebccde5b","character":"5cd99d4bde30eff6ebccfc15","id":"5cd96e05de30eff6ebcce9d0"},{"_id":"5cd96e05de30eff6ebcce9d1","dialog":"Smeagol?","movie":"5cd95395de30eff6ebccde5b","character":"5cd99d4bde30eff6ebccfc15","id":"5cd96e05de30eff6ebcce9d1"}],"total":1009,"limit":10,"offset":0,"page":1,"pages":101}'
|
146
|
+
recorded_at: Sun, 12 Mar 2023 23:14:36 GMT
|
147
|
+
recorded_with: VCR 6.1.0
|
data/j_sdk.gemspec
ADDED
@@ -0,0 +1,39 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative "lib/j_sdk/version"
|
4
|
+
|
5
|
+
Gem::Specification.new do |spec|
|
6
|
+
spec.name = "j_sdk"
|
7
|
+
spec.version = JSdk::VERSION
|
8
|
+
spec.authors = ["Jose M. Tobar"]
|
9
|
+
spec.email = ["josemtobarjobs@gmail.com"]
|
10
|
+
|
11
|
+
spec.summary = "SDK for Lord of The Rings Data"
|
12
|
+
# spec.description = "TODO: Write a longer description or delete this line."
|
13
|
+
spec.homepage = "https://github.com/ilovemysillybanana/j_sdk"
|
14
|
+
spec.license = "MIT"
|
15
|
+
spec.required_ruby_version = ">= 2.6.0"
|
16
|
+
|
17
|
+
# spec.metadata["allowed_push_host"] = "https://rubygems.pkg.github.com/ilovemysillybanana"
|
18
|
+
|
19
|
+
spec.metadata["homepage_uri"] = spec.homepage
|
20
|
+
spec.metadata["source_code_uri"] = "https://github.com/ilovemysillybanana/j_sdk"
|
21
|
+
spec.metadata["changelog_uri"] = "https://github.com/ilovemysillybanana/j_sdk/blob/master/CHANGELOG.md"
|
22
|
+
|
23
|
+
# Specify which files should be added to the gem when it is released.
|
24
|
+
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
|
25
|
+
spec.files = Dir.chdir(File.expand_path(__dir__)) do
|
26
|
+
`git ls-files -z`.split("\x0").reject do |f|
|
27
|
+
(f == __FILE__) || f.match(%r{\A(?:(?:bin|test|spec|features)/|\.(?:git|travis|circleci)|appveyor)})
|
28
|
+
end
|
29
|
+
end
|
30
|
+
spec.bindir = "exe"
|
31
|
+
spec.executables = spec.files.grep(%r{\Aexe/}) { |f| File.basename(f) }
|
32
|
+
spec.require_paths = ["lib"]
|
33
|
+
|
34
|
+
# Uncomment to register a new dependency of your gem
|
35
|
+
# spec.add_dependency "example-gem", "~> 1.0"
|
36
|
+
|
37
|
+
# For more information and examples about making a new gem, check out our
|
38
|
+
# guide at: https://bundler.io/guides/creating_gem.html
|
39
|
+
end
|
data/lib/j_sdk/lotr.rb
ADDED
@@ -0,0 +1,77 @@
|
|
1
|
+
module JSdk
|
2
|
+
# @@api_token = "TOKEN_VALUE"
|
3
|
+
|
4
|
+
# def self.token()
|
5
|
+
# @@api_token
|
6
|
+
# end
|
7
|
+
|
8
|
+
# def self.set_token(token)
|
9
|
+
# @@api_token = token
|
10
|
+
# end
|
11
|
+
|
12
|
+
class LOTR
|
13
|
+
attr_accessor :token
|
14
|
+
|
15
|
+
BASE_URL = "https://the-one-api.dev/v2"
|
16
|
+
|
17
|
+
def initialize(token)
|
18
|
+
@token = token
|
19
|
+
end
|
20
|
+
|
21
|
+
def get_movies()
|
22
|
+
uri = URI("#{BASE_URL}/movie")
|
23
|
+
res = Net::HTTP.get_response(uri, headers)
|
24
|
+
data = JSON.parse(res.body)['docs']
|
25
|
+
movies = data.map do |mv|
|
26
|
+
Movie.new(
|
27
|
+
mv['_id'],
|
28
|
+
mv['name'],
|
29
|
+
mv['runtimeInMinutes'],
|
30
|
+
mv['budgetInMillions'],
|
31
|
+
mv['boxOfficeRevenueInMillions'],
|
32
|
+
mv['academyAwardNominations'],
|
33
|
+
mv['academyAwardWins'],
|
34
|
+
mv['rottenTomatoesScore'],
|
35
|
+
self
|
36
|
+
)
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
def get_movie(id)
|
41
|
+
uri = URI("#{BASE_URL}/movie/#{id}")
|
42
|
+
res = Net::HTTP.get_response(uri, headers)
|
43
|
+
data = JSON.parse(res.body)['docs'][0]
|
44
|
+
movie = Movie.new(
|
45
|
+
data['_id'],
|
46
|
+
data['name'],
|
47
|
+
data['runtimeInMinutes'],
|
48
|
+
data['budgetInMillions'],
|
49
|
+
data['boxOfficeRevenueInMillions'],
|
50
|
+
data['academyAwardNominations'],
|
51
|
+
data['academyAwardWins'],
|
52
|
+
data['rottenTomatoesScore'],
|
53
|
+
self
|
54
|
+
)
|
55
|
+
end
|
56
|
+
|
57
|
+
def get_quotes(id, limit=10, page=0)
|
58
|
+
uri = URI("#{BASE_URL}/movie/#{id}/quote?limit=10")
|
59
|
+
res = Net::HTTP.get_response(uri, headers)
|
60
|
+
data = JSON.parse(res.body)['docs']
|
61
|
+
quotes = data.map do |quote|
|
62
|
+
Quote.new(
|
63
|
+
quote['id'],
|
64
|
+
quote['dialog'],
|
65
|
+
quote['movie'],
|
66
|
+
quote['character'],
|
67
|
+
self
|
68
|
+
)
|
69
|
+
end
|
70
|
+
end
|
71
|
+
|
72
|
+
private
|
73
|
+
def headers()
|
74
|
+
{ 'Authorization' => "Bearer #{token}" }
|
75
|
+
end
|
76
|
+
end
|
77
|
+
end
|
data/lib/j_sdk/movie.rb
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
module JSdk
|
2
|
+
class Movie
|
3
|
+
attr_reader :id, :name, :runtimeInMinutes, :budgetInMillions, :boxOfficeRevenueInMillions, :academyAwardNominations, :academyAwardWins, :rottenTomatoesScore, :client
|
4
|
+
|
5
|
+
def initialize(id, name, runtimeInMinutes, budgetInMillions, boxOfficeRevenueInMillions, academyAwardNominations, academyAwardWins, rottenTomatoesScore, client)
|
6
|
+
@id = id
|
7
|
+
@name = name
|
8
|
+
@runtimeInMinutes = runtimeInMinutes
|
9
|
+
@budgetInMillions = budgetInMillions
|
10
|
+
@boxOfficeRevenueInMillions = boxOfficeRevenueInMillions
|
11
|
+
@academyAwardNominations = academyAwardNominations
|
12
|
+
@academyAwardWins = academyAwardWins
|
13
|
+
@rottenTomatoesScore = rottenTomatoesScore
|
14
|
+
@client = client
|
15
|
+
end
|
16
|
+
|
17
|
+
def get_quotes(limit=10, page=0)
|
18
|
+
@client.get_quotes(self.id, limit, page)
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
data/lib/j_sdk/quote.rb
ADDED
@@ -0,0 +1,13 @@
|
|
1
|
+
module JSdk
|
2
|
+
class Quote
|
3
|
+
attr_reader :id, :dialog, :movie_id, :character_id, :client
|
4
|
+
|
5
|
+
def initialize(id, dialog, movie_id, character_id, client)
|
6
|
+
@id = id
|
7
|
+
@dialog = dialog
|
8
|
+
@movie_id = movie_id
|
9
|
+
@character_id = character_id
|
10
|
+
@client = client
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
data/lib/j_sdk.rb
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
require 'net/http'
|
2
|
+
require 'json'
|
3
|
+
|
4
|
+
# frozen_string_literal: true
|
5
|
+
|
6
|
+
require_relative "j_sdk/version"
|
7
|
+
require_relative "j_sdk/quote"
|
8
|
+
require_relative "j_sdk/lotr"
|
9
|
+
require_relative "j_sdk/movie"
|
10
|
+
|
11
|
+
module JSdk
|
12
|
+
class Error < StandardError; end
|
13
|
+
# Your code goes here...
|
14
|
+
end
|
data/sig/j_sdk.rbs
ADDED
metadata
ADDED
@@ -0,0 +1,65 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: j_sdk
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Jose M. Tobar
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2023-03-13 00:00:00.000000000 Z
|
12
|
+
dependencies: []
|
13
|
+
description:
|
14
|
+
email:
|
15
|
+
- josemtobarjobs@gmail.com
|
16
|
+
executables: []
|
17
|
+
extensions: []
|
18
|
+
extra_rdoc_files: []
|
19
|
+
files:
|
20
|
+
- ".DS_Store"
|
21
|
+
- ".rspec"
|
22
|
+
- CHANGELOG.md
|
23
|
+
- Gemfile
|
24
|
+
- Gemfile.lock
|
25
|
+
- LICENSE.txt
|
26
|
+
- README.md
|
27
|
+
- Rakefile
|
28
|
+
- fixtures/cassettes/get_movie-5cd95395de30eff6ebccde5b.yml
|
29
|
+
- fixtures/cassettes/get_movies.yml
|
30
|
+
- fixtures/cassettes/get_quotes-5cd95395de30eff6ebccde56.yml
|
31
|
+
- fixtures/cassettes/get_quotes-5cd95395de30eff6ebccde5b.yml
|
32
|
+
- j_sdk.gemspec
|
33
|
+
- lib/j_sdk.rb
|
34
|
+
- lib/j_sdk/lotr.rb
|
35
|
+
- lib/j_sdk/movie.rb
|
36
|
+
- lib/j_sdk/quote.rb
|
37
|
+
- lib/j_sdk/version.rb
|
38
|
+
- sig/j_sdk.rbs
|
39
|
+
homepage: https://github.com/ilovemysillybanana/j_sdk
|
40
|
+
licenses:
|
41
|
+
- MIT
|
42
|
+
metadata:
|
43
|
+
homepage_uri: https://github.com/ilovemysillybanana/j_sdk
|
44
|
+
source_code_uri: https://github.com/ilovemysillybanana/j_sdk
|
45
|
+
changelog_uri: https://github.com/ilovemysillybanana/j_sdk/blob/master/CHANGELOG.md
|
46
|
+
post_install_message:
|
47
|
+
rdoc_options: []
|
48
|
+
require_paths:
|
49
|
+
- lib
|
50
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: 2.6.0
|
55
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
56
|
+
requirements:
|
57
|
+
- - ">="
|
58
|
+
- !ruby/object:Gem::Version
|
59
|
+
version: '0'
|
60
|
+
requirements: []
|
61
|
+
rubygems_version: 3.3.7
|
62
|
+
signing_key:
|
63
|
+
specification_version: 4
|
64
|
+
summary: SDK for Lord of The Rings Data
|
65
|
+
test_files: []
|