omdb-api 1.3.0 → 2.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.rubocop.yml +3 -0
- data/CHANGELOG.md +19 -0
- data/Gemfile +1 -0
- data/README.md +49 -45
- data/Rakefile +3 -1
- data/lib/omdb/api.rb +0 -8
- data/lib/omdb/api/client.rb +14 -5
- data/lib/omdb/api/public_api.rb +9 -35
- data/lib/omdb/api/public_api/find_by.rb +25 -0
- data/lib/omdb/api/public_api/search.rb +17 -0
- data/lib/omdb/api/request.rb +46 -21
- data/lib/omdb/api/types.rb +8 -0
- data/lib/omdb/api/types/base.rb +11 -0
- data/lib/omdb/api/types/error.rb +14 -0
- data/lib/omdb/api/types/movie.rb +34 -0
- data/lib/omdb/api/types/movie_result.rb +17 -0
- data/lib/omdb/api/types/movies.rb +13 -0
- data/lib/omdb/api/utils.rb +32 -0
- data/lib/omdb/api/version.rb +1 -1
- data/omdb-api.gemspec +4 -3
- metadata +39 -19
- data/lib/omdb/api/collection.rb +0 -18
- data/lib/omdb/api/error.rb +0 -16
- data/lib/omdb/api/movie.rb +0 -34
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: dc18a31e3a6e5ac9b7825783220ad5b8c05195150845a8042a54294528f4867a
|
4
|
+
data.tar.gz: c729c986aa822cd3fdfbea991d55154cc8709d73e250a2fb524086cafe1f739e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 846f21c9236f28a6d6415f7ba95825a4ee253f4d26f464c994cc7e0cee3fa86031af404167515f04a7c2def257d577a948139ded15c584da584ade2984f8bf3f
|
7
|
+
data.tar.gz: 001ae8d21322fa92ff346d9c08aa8025a2e4ce1bf19cbd4d268bcc7177764e56bcd79d17006bebe6dff014550d60e15021c677db67fb1188d8170fd3f295a130
|
data/.rubocop.yml
CHANGED
data/CHANGELOG.md
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
## 2.0 (2020-07-26)
|
2
|
+
|
3
|
+
### Breaking Changes
|
4
|
+
|
5
|
+
* query params given to the client will be full words
|
6
|
+
and mapped to the Omdb API params - implemented so far:
|
7
|
+
|
8
|
+
```ruby
|
9
|
+
{
|
10
|
+
id: 'i',
|
11
|
+
title: 't',
|
12
|
+
search: 's',
|
13
|
+
plot: 'plot',
|
14
|
+
year: 'y',
|
15
|
+
version: 'v'
|
16
|
+
}
|
17
|
+
```
|
18
|
+
|
19
|
+
* a collection is now called `Movies` and will return `MovieResult` objects
|
data/Gemfile
CHANGED
data/README.md
CHANGED
@@ -6,7 +6,7 @@
|
|
6
6
|
|
7
7
|
## Required
|
8
8
|
|
9
|
-
You must request an API key first from [here](http://omdbapi.com/)
|
9
|
+
You must request an API key first from [here](http://omdbapi.com/apikey.aspx)
|
10
10
|
|
11
11
|
## Installation
|
12
12
|
|
@@ -30,7 +30,9 @@ Or install it yourself as:
|
|
30
30
|
|
31
31
|
First you have to create a client object with your API key
|
32
32
|
|
33
|
-
|
33
|
+
```ruby
|
34
|
+
client = Omdb::Api::Client.new(api_key: [your API key])`
|
35
|
+
```
|
34
36
|
|
35
37
|
You can also set the API key with a block
|
36
38
|
|
@@ -40,7 +42,7 @@ client = Omdb::Api::Client.new do |config|
|
|
40
42
|
end
|
41
43
|
```
|
42
44
|
|
43
|
-
###
|
45
|
+
### Fetching
|
44
46
|
|
45
47
|
```ruby
|
46
48
|
require 'omdb/api'
|
@@ -60,52 +62,54 @@ the OMDB API spec.
|
|
60
62
|
|
61
63
|
For example:
|
62
64
|
|
63
|
-
`client.find_by_title('star wars', plot: 'short')`
|
64
|
-
|
65
|
-
Returns an `Omdb::Api::Movie`
|
66
|
-
|
67
|
-
`#find_by_id('id')`
|
68
|
-
|
69
|
-
`#find_by_title('title')`
|
70
|
-
|
71
|
-
Returns an `Omdb::Api::Collection`
|
72
|
-
|
73
|
-
`#search('movie')`
|
74
|
-
|
75
|
-
An unsuccessful query will return an `Omdb::Api::Error` object
|
76
|
-
|
77
|
-
|
78
|
-
An `Omdb::Api::Movie` object has
|
79
|
-
|
80
65
|
```ruby
|
81
|
-
|
82
|
-
#awards
|
83
|
-
#country
|
84
|
-
#director
|
85
|
-
#genre
|
86
|
-
#imdb_id
|
87
|
-
#imdb_rating
|
88
|
-
#imdb_votes
|
89
|
-
#language
|
90
|
-
#metascore
|
91
|
-
#plot
|
92
|
-
#poster
|
93
|
-
#rated
|
94
|
-
#released
|
95
|
-
#response
|
96
|
-
#runtime
|
97
|
-
#title
|
98
|
-
#type
|
99
|
-
#writer
|
100
|
-
#year
|
66
|
+
client.find_by_title('star wars', plot: 'short')`
|
101
67
|
```
|
102
68
|
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
69
|
+
Returns an `Omdb::Api::Types::Movie`
|
70
|
+
|
71
|
+
An unsuccessful query will return an `Omdb::Api::Types::Error` object
|
72
|
+
|
73
|
+
## TODO
|
74
|
+
Implement all all find options
|
75
|
+
|
76
|
+
|
77
|
+
## API
|
78
|
+
|
79
|
+
**Parent**<br />
|
80
|
+
Omdb::Api::Movie
|
81
|
+
|
82
|
+
**Methods**<br />
|
83
|
+
#actors<br />
|
84
|
+
#awards<br />
|
85
|
+
#box_office<br />
|
86
|
+
#country<br />
|
87
|
+
#director<br />
|
88
|
+
#dvd<br />
|
89
|
+
#error<br />
|
90
|
+
#genre<br />
|
91
|
+
#imdb_id<br />
|
92
|
+
#imdb_rating<br />
|
93
|
+
#imdb_votes<br />
|
94
|
+
#language<br />
|
95
|
+
#metascore<br />
|
96
|
+
#plot<br />
|
97
|
+
#poster<br />
|
98
|
+
#rated<br />
|
99
|
+
#released<br />
|
100
|
+
#runtime<br />
|
101
|
+
#title<br />
|
102
|
+
#type<br />
|
103
|
+
#writer<br />
|
104
|
+
#year<br />
|
105
|
+
|
106
|
+
|
107
|
+
**Parent**<br />
|
108
|
+
Omdb::Api::Error
|
109
|
+
|
110
|
+
**Methods**<br />
|
111
|
+
#response<br />
|
107
112
|
#error
|
108
|
-
```
|
109
113
|
|
110
114
|
## Development
|
111
115
|
|
data/Rakefile
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'bundler/gem_tasks'
|
2
4
|
require 'rspec/core/rake_task'
|
3
5
|
require 'rubocop/rake_task'
|
@@ -5,4 +7,4 @@ require 'rubocop/rake_task'
|
|
5
7
|
RSpec::Core::RakeTask.new(:spec)
|
6
8
|
RuboCop::RakeTask.new
|
7
9
|
|
8
|
-
task default: %i[spec rubocop]
|
10
|
+
task default: %i[spec rubocop:auto_correct]
|
data/lib/omdb/api.rb
CHANGED
@@ -1,12 +1,4 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
require 'omdb/api/version'
|
4
|
-
require 'omdb/api/collection'
|
5
|
-
require 'omdb/api/movie'
|
6
|
-
require 'omdb/api/public_api'
|
7
4
|
require 'omdb/api/client'
|
8
|
-
require 'omdb/api/request'
|
9
|
-
require 'omdb/api/error'
|
10
|
-
require 'active_support'
|
11
|
-
require 'active_support/core_ext/string'
|
12
|
-
require 'httparty'
|
data/lib/omdb/api/client.rb
CHANGED
@@ -1,18 +1,27 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
+
require 'omdb/api/public_api'
|
4
|
+
|
3
5
|
module Omdb
|
4
6
|
module Api
|
5
7
|
class Client
|
6
8
|
include PublicApi
|
7
9
|
|
8
|
-
|
10
|
+
attr_reader :configuration
|
9
11
|
|
10
12
|
def initialize(options = {})
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
13
|
+
@configuration = Configuration.new
|
14
|
+
|
15
|
+
options.each { |k, v| @configuration.__send__("#{k}=", v) }
|
16
|
+
|
17
|
+
yield(@configuration) if block_given?
|
15
18
|
end
|
19
|
+
|
20
|
+
class Configuration
|
21
|
+
attr_accessor :api_key
|
22
|
+
end
|
23
|
+
|
24
|
+
private_constant :Configuration
|
16
25
|
end
|
17
26
|
end
|
18
27
|
end
|
data/lib/omdb/api/public_api.rb
CHANGED
@@ -1,43 +1,17 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
+
require 'omdb/api/request'
|
4
|
+
require 'omdb/api/utils'
|
5
|
+
require 'omdb/api/types'
|
6
|
+
require 'omdb/api/public_api/find_by'
|
7
|
+
require 'omdb/api/public_api/search'
|
8
|
+
|
3
9
|
module Omdb
|
4
10
|
module Api
|
5
11
|
module PublicApi
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
data = request.response
|
11
|
-
movie = __format_data(data)
|
12
|
-
|
13
|
-
if request.success?
|
14
|
-
Omdb::Api::Movie.new(movie)
|
15
|
-
else
|
16
|
-
Omdb::Api::Error.new(movie)
|
17
|
-
end
|
18
|
-
end
|
19
|
-
end
|
20
|
-
|
21
|
-
def search(value, options = {})
|
22
|
-
request = Omdb::Api::Request.new(self, 'search', value, options)
|
23
|
-
|
24
|
-
if request.success?
|
25
|
-
Omdb::Api::Collection.new(
|
26
|
-
request.response.fetch('Search').map do |movie|
|
27
|
-
movie = __format_data(movie)
|
28
|
-
|
29
|
-
Omdb::Api::Movie.new(movie)
|
30
|
-
end
|
31
|
-
)
|
32
|
-
else
|
33
|
-
Omdb::Api::Error.new(request.response)
|
34
|
-
end
|
35
|
-
end
|
36
|
-
|
37
|
-
def __format_data(data)
|
38
|
-
keys = data.keys.map(&:underscore)
|
39
|
-
keys.zip(data.values).to_h
|
40
|
-
end
|
12
|
+
include Utils
|
13
|
+
include FindBy
|
14
|
+
include Search
|
41
15
|
end
|
42
16
|
end
|
43
17
|
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Omdb
|
4
|
+
module Api
|
5
|
+
module PublicApi
|
6
|
+
module FindBy
|
7
|
+
def find_by_id(id, **options)
|
8
|
+
perform_get(
|
9
|
+
klass: Omdb::Api::Types::Movie,
|
10
|
+
query_params: { id: id }.merge(options),
|
11
|
+
headers: options.fetch(:headers, {})
|
12
|
+
)
|
13
|
+
end
|
14
|
+
|
15
|
+
def find_by_title(title, **options)
|
16
|
+
perform_get(
|
17
|
+
klass: Omdb::Api::Types::Movie,
|
18
|
+
query_params: { title: title }.merge(options),
|
19
|
+
headers: options.fetch(:headers, {})
|
20
|
+
)
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Omdb
|
4
|
+
module Api
|
5
|
+
module PublicApi
|
6
|
+
module Search
|
7
|
+
def search(value, **options)
|
8
|
+
perform_get(
|
9
|
+
klass: Omdb::Api::Types::Movies,
|
10
|
+
query_params: { search: value }.merge(options),
|
11
|
+
headers: options.fetch(:headers, {})
|
12
|
+
)
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
data/lib/omdb/api/request.rb
CHANGED
@@ -1,35 +1,60 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
+
require 'httparty'
|
4
|
+
|
3
5
|
module Omdb
|
4
6
|
module Api
|
5
7
|
class Request
|
6
|
-
BASE_URI = 'https://www.omdbapi.com'
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
@
|
12
|
-
@
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
8
|
+
BASE_URI = 'https://www.omdbapi.com'
|
9
|
+
|
10
|
+
def initialize(client, request_method, params)
|
11
|
+
@configuration = client.configuration
|
12
|
+
@request_method = request_method
|
13
|
+
@headers = _set_headers(params.delete(:headers))
|
14
|
+
@params = _set_params(params.delete(:query_params))
|
15
|
+
end
|
16
|
+
|
17
|
+
def perform
|
18
|
+
_http_client.public_send(
|
19
|
+
@request_method,
|
20
|
+
BASE_URI,
|
21
|
+
headers: @headers,
|
22
|
+
query: @params
|
23
|
+
)
|
21
24
|
end
|
22
25
|
|
23
|
-
|
24
|
-
|
26
|
+
private
|
27
|
+
|
28
|
+
PARAMS_MAP = {
|
29
|
+
id: 'i',
|
30
|
+
title: 't',
|
31
|
+
search: 's',
|
32
|
+
plot: 'plot',
|
33
|
+
year: 'y',
|
34
|
+
return: 'r',
|
35
|
+
version: 'v'
|
36
|
+
}.freeze
|
37
|
+
|
38
|
+
def _set_params(params)
|
39
|
+
{}.tap do |p|
|
40
|
+
params.each { |k, v| p[PARAMS_MAP[k]] = v }
|
41
|
+
end.merge({ apikey: @configuration.api_key })
|
25
42
|
end
|
26
43
|
|
27
|
-
def
|
28
|
-
|
44
|
+
def _set_headers(headers)
|
45
|
+
key_translate = {
|
46
|
+
content_type: 'Content-Type'
|
47
|
+
}
|
48
|
+
|
49
|
+
translated_headers = headers.each_with_object({}) do |(k, v), o|
|
50
|
+
o[key_translate[k]] = v
|
51
|
+
end
|
52
|
+
|
53
|
+
{ 'Content-Type' => 'application/json' }.merge(translated_headers)
|
29
54
|
end
|
30
55
|
|
31
|
-
def
|
32
|
-
|
56
|
+
def _http_client
|
57
|
+
HTTParty
|
33
58
|
end
|
34
59
|
end
|
35
60
|
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Omdb
|
4
|
+
module Api
|
5
|
+
module Types
|
6
|
+
include Dry.Types()
|
7
|
+
|
8
|
+
class Error < Base
|
9
|
+
attribute :response, Omdb::Api::Types::String.optional.default(nil)
|
10
|
+
attribute :error, Omdb::Api::Types::String.optional.default(nil)
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
@@ -0,0 +1,34 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Omdb
|
4
|
+
module Api
|
5
|
+
module Types
|
6
|
+
include Dry.Types()
|
7
|
+
|
8
|
+
class Movie < Base
|
9
|
+
attribute :actors, Omdb::Api::Types::String.optional.default(nil)
|
10
|
+
attribute :awards, Omdb::Api::Types::String.optional.default(nil)
|
11
|
+
attribute :box_office, Omdb::Api::Types::String.optional.default(nil)
|
12
|
+
attribute :country, Omdb::Api::Types::String.optional.default(nil)
|
13
|
+
attribute :director, Omdb::Api::Types::String.optional.default(nil)
|
14
|
+
attribute :dvd, Omdb::Api::Types::String.optional.default(nil)
|
15
|
+
attribute :error, Omdb::Api::Types::String.optional.default(nil)
|
16
|
+
attribute :genre, Omdb::Api::Types::String.optional.default(nil)
|
17
|
+
attribute :imdb_id, Omdb::Api::Types::String.optional.default(nil)
|
18
|
+
attribute :imdb_rating, Omdb::Api::Types::String.optional.default(nil)
|
19
|
+
attribute :imdb_votes, Omdb::Api::Types::String.optional.default(nil)
|
20
|
+
attribute :language, Omdb::Api::Types::String.optional.default(nil)
|
21
|
+
attribute :metascore, Omdb::Api::Types::String.optional.default(nil)
|
22
|
+
attribute :plot, Omdb::Api::Types::String.optional.default(nil)
|
23
|
+
attribute :poster, Omdb::Api::Types::String.optional.default(nil)
|
24
|
+
attribute :rated, Omdb::Api::Types::String.optional.default(nil)
|
25
|
+
attribute :released, Omdb::Api::Types::String.optional.default(nil)
|
26
|
+
attribute :runtime, Omdb::Api::Types::String.optional.default(nil)
|
27
|
+
attribute :title, Omdb::Api::Types::String.optional.default(nil)
|
28
|
+
attribute :type, Omdb::Api::Types::String.optional.default(nil)
|
29
|
+
attribute :writer, Omdb::Api::Types::String.optional.default(nil)
|
30
|
+
attribute :year, Omdb::Api::Types::String.optional.default(nil)
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Omdb
|
4
|
+
module Api
|
5
|
+
module Types
|
6
|
+
include Dry.Types()
|
7
|
+
|
8
|
+
class MovieResult < Base
|
9
|
+
attribute :imdb_id, Omdb::Api::Types::String.optional.default(nil)
|
10
|
+
attribute :poster, Omdb::Api::Types::String.optional.default(nil)
|
11
|
+
attribute :title, Omdb::Api::Types::String.optional.default(nil)
|
12
|
+
attribute :type, Omdb::Api::Types::String.optional.default(nil)
|
13
|
+
attribute :year, Omdb::Api::Types::String.optional.default(nil)
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Omdb
|
4
|
+
module Api
|
5
|
+
module Types
|
6
|
+
include Dry.Types()
|
7
|
+
|
8
|
+
class Movies < Base
|
9
|
+
attribute :search, Omdb::Api::Types::Strict::Array.of(Omdb::Api::Types::MovieResult).optional.default([])
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
@@ -0,0 +1,32 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'active_support/all'
|
4
|
+
|
5
|
+
module Omdb
|
6
|
+
module Api
|
7
|
+
module Utils
|
8
|
+
def perform_get(options)
|
9
|
+
perform_request(:get, options)
|
10
|
+
end
|
11
|
+
|
12
|
+
def perform_request(request_method, options)
|
13
|
+
klass = options.delete(:klass)
|
14
|
+
|
15
|
+
_response_handler(klass) do
|
16
|
+
Omdb::Api::Request.new(self, request_method, options).perform
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
def _response_handler(klass)
|
21
|
+
_handle_response(yield, klass)
|
22
|
+
# rescue Errno::ECONNREFUSED => e
|
23
|
+
end
|
24
|
+
|
25
|
+
def _handle_response(resp, klass)
|
26
|
+
resp.deep_transform_keys! { |k| k.underscore.to_sym }
|
27
|
+
|
28
|
+
resp.fetch(:response) == 'True' ? klass.new(resp) : Omdb::Api::Types::Error.new(resp)
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
data/lib/omdb/api/version.rb
CHANGED
data/omdb-api.gemspec
CHANGED
@@ -10,7 +10,7 @@ Gem::Specification.new do |spec|
|
|
10
10
|
spec.authors = ['Nick Palaniuk']
|
11
11
|
spec.email = ['npalaniuk@gmail.com']
|
12
12
|
spec.summary = 'Ruby interface for the OMDB API'
|
13
|
-
spec.description = '
|
13
|
+
spec.description = 'Ruby interface for the OMDB API'
|
14
14
|
spec.homepage = 'https://github.com/nikkypx/omdb-api'
|
15
15
|
spec.license = 'MIT'
|
16
16
|
spec.files = `git ls-files -z`.split("\x0").reject do |f|
|
@@ -18,7 +18,8 @@ Gem::Specification.new do |spec|
|
|
18
18
|
end
|
19
19
|
|
20
20
|
spec.require_paths = ['lib']
|
21
|
-
spec.add_dependency 'activesupport'
|
22
|
-
spec.add_dependency '
|
21
|
+
spec.add_dependency 'activesupport', '~> 4.2.10'
|
22
|
+
spec.add_dependency 'dry-struct', '~> 1.3'
|
23
|
+
spec.add_dependency 'httparty', '~> 0.15'
|
23
24
|
spec.add_development_dependency 'bundler'
|
24
25
|
end
|
metadata
CHANGED
@@ -1,43 +1,57 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: omdb-api
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 2.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Nick Palaniuk
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2020-09-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - "
|
17
|
+
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version:
|
19
|
+
version: 4.2.10
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- - "
|
24
|
+
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version:
|
26
|
+
version: 4.2.10
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: dry-struct
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '1.3'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '1.3'
|
27
41
|
- !ruby/object:Gem::Dependency
|
28
42
|
name: httparty
|
29
43
|
requirement: !ruby/object:Gem::Requirement
|
30
44
|
requirements:
|
31
|
-
- - "
|
45
|
+
- - "~>"
|
32
46
|
- !ruby/object:Gem::Version
|
33
|
-
version: '0'
|
47
|
+
version: '0.15'
|
34
48
|
type: :runtime
|
35
49
|
prerelease: false
|
36
50
|
version_requirements: !ruby/object:Gem::Requirement
|
37
51
|
requirements:
|
38
|
-
- - "
|
52
|
+
- - "~>"
|
39
53
|
- !ruby/object:Gem::Version
|
40
|
-
version: '0'
|
54
|
+
version: '0.15'
|
41
55
|
- !ruby/object:Gem::Dependency
|
42
56
|
name: bundler
|
43
57
|
requirement: !ruby/object:Gem::Requirement
|
@@ -52,7 +66,7 @@ dependencies:
|
|
52
66
|
- - ">="
|
53
67
|
- !ruby/object:Gem::Version
|
54
68
|
version: '0'
|
55
|
-
description:
|
69
|
+
description: Ruby interface for the OMDB API
|
56
70
|
email:
|
57
71
|
- npalaniuk@gmail.com
|
58
72
|
executables: []
|
@@ -63,24 +77,31 @@ files:
|
|
63
77
|
- ".rspec"
|
64
78
|
- ".rubocop.yml"
|
65
79
|
- ".travis.yml"
|
80
|
+
- CHANGELOG.md
|
66
81
|
- Gemfile
|
67
82
|
- LICENSE.txt
|
68
83
|
- README.md
|
69
84
|
- Rakefile
|
70
85
|
- lib/omdb/api.rb
|
71
86
|
- lib/omdb/api/client.rb
|
72
|
-
- lib/omdb/api/collection.rb
|
73
|
-
- lib/omdb/api/error.rb
|
74
|
-
- lib/omdb/api/movie.rb
|
75
87
|
- lib/omdb/api/public_api.rb
|
88
|
+
- lib/omdb/api/public_api/find_by.rb
|
89
|
+
- lib/omdb/api/public_api/search.rb
|
76
90
|
- lib/omdb/api/request.rb
|
91
|
+
- lib/omdb/api/types.rb
|
92
|
+
- lib/omdb/api/types/base.rb
|
93
|
+
- lib/omdb/api/types/error.rb
|
94
|
+
- lib/omdb/api/types/movie.rb
|
95
|
+
- lib/omdb/api/types/movie_result.rb
|
96
|
+
- lib/omdb/api/types/movies.rb
|
97
|
+
- lib/omdb/api/utils.rb
|
77
98
|
- lib/omdb/api/version.rb
|
78
99
|
- omdb-api.gemspec
|
79
100
|
homepage: https://github.com/nikkypx/omdb-api
|
80
101
|
licenses:
|
81
102
|
- MIT
|
82
103
|
metadata: {}
|
83
|
-
post_install_message:
|
104
|
+
post_install_message:
|
84
105
|
rdoc_options: []
|
85
106
|
require_paths:
|
86
107
|
- lib
|
@@ -95,9 +116,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
95
116
|
- !ruby/object:Gem::Version
|
96
117
|
version: '0'
|
97
118
|
requirements: []
|
98
|
-
|
99
|
-
|
100
|
-
signing_key:
|
119
|
+
rubygems_version: 3.0.3
|
120
|
+
signing_key:
|
101
121
|
specification_version: 4
|
102
122
|
summary: Ruby interface for the OMDB API
|
103
123
|
test_files: []
|
data/lib/omdb/api/collection.rb
DELETED
@@ -1,18 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Omdb
|
4
|
-
module Api
|
5
|
-
class Collection
|
6
|
-
include Enumerable
|
7
|
-
attr_accessor :movies
|
8
|
-
|
9
|
-
def initialize(movies)
|
10
|
-
self.movies = Array.new(movies)
|
11
|
-
end
|
12
|
-
|
13
|
-
def each
|
14
|
-
movies.each { |item| yield item }
|
15
|
-
end
|
16
|
-
end
|
17
|
-
end
|
18
|
-
end
|
data/lib/omdb/api/error.rb
DELETED
data/lib/omdb/api/movie.rb
DELETED
@@ -1,34 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Omdb
|
4
|
-
module Api
|
5
|
-
class Movie
|
6
|
-
attr_reader :actors
|
7
|
-
:awards
|
8
|
-
:country
|
9
|
-
:director
|
10
|
-
:genre
|
11
|
-
:imdb_id
|
12
|
-
:imdb_rating
|
13
|
-
:imdb_votes
|
14
|
-
:language
|
15
|
-
:metascore
|
16
|
-
:plot
|
17
|
-
:poster
|
18
|
-
:rated
|
19
|
-
:released
|
20
|
-
:runtime
|
21
|
-
:title
|
22
|
-
:type
|
23
|
-
:writer
|
24
|
-
:year
|
25
|
-
:error
|
26
|
-
|
27
|
-
def initialize(params)
|
28
|
-
params.each_pair do |k, v|
|
29
|
-
instance_variable_set("@#{k}", v)
|
30
|
-
end
|
31
|
-
end
|
32
|
-
end
|
33
|
-
end
|
34
|
-
end
|