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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 5ab13fc688f385555e5943cf24d9409431156756
4
- data.tar.gz: 7e53cf0aa675478c43790c56c7234f93e7e8cce9
2
+ SHA256:
3
+ metadata.gz: dc18a31e3a6e5ac9b7825783220ad5b8c05195150845a8042a54294528f4867a
4
+ data.tar.gz: c729c986aa822cd3fdfbea991d55154cc8709d73e250a2fb524086cafe1f739e
5
5
  SHA512:
6
- metadata.gz: 5550804cdcb6699423742b389ac129d6c4e12006f639f94c721afebc7e62bce3893dfbc5972b23ae3c2d9888d2d5d60a00b4f89033acdd4d37ebf75dbed49665
7
- data.tar.gz: 58e4a89affad3c803551a367d62aef3505083e493d0c1d3deb44e667878825d8ce168a1f4b3efc7675d25d1dc63f94a8bb14150852cda270ece202c370cbcdae
6
+ metadata.gz: 846f21c9236f28a6d6415f7ba95825a4ee253f4d26f464c994cc7e0cee3fa86031af404167515f04a7c2def257d577a948139ded15c584da584ade2984f8bf3f
7
+ data.tar.gz: 001ae8d21322fa92ff346d9c08aa8025a2e4ce1bf19cbd4d268bcc7177764e56bcd79d17006bebe6dff014550d60e15021c677db67fb1188d8170fd3f295a130
@@ -6,3 +6,6 @@ Style/Documentation:
6
6
 
7
7
  Lint/Void:
8
8
  Enabled: false
9
+
10
+ Layout/LineLength:
11
+ Enabled: false
@@ -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
@@ -9,6 +9,7 @@ group :development do
9
9
  end
10
10
 
11
11
  group :test do
12
+ gem 'faker'
12
13
  gem 'rspec'
13
14
  gem 'rubocop'
14
15
  gem 'webmock'
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
- `client = Omdb::Api::Client.new(api_key: [your API key])`
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
- ### API
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
- #actors
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
- An `Omdb::Api::Error` object has
104
-
105
- ```ruby
106
- #response
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]
@@ -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'
@@ -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
- attr_accessor :api_key
10
+ attr_reader :configuration
9
11
 
10
12
  def initialize(options = {})
11
- options.each_pair do |k, v|
12
- instance_variable_set("@#{k}", v)
13
- end
14
- yield(self) if block_given?
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
@@ -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
- %i[find_by_id find_by_title].each do |method|
7
- define_method(method) do |value, **options|
8
- request = Omdb::Api::Request.new(self, method, value, options)
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
@@ -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'.freeze
7
-
8
- attr_reader :api_key, :field, :value, :options
9
-
10
- def initialize(client, method, value, options)
11
- @api_key = client.api_key
12
- @value = CGI.escape(value)
13
- @options = options
14
- @field = if /id/.match?(method)
15
- 'i'
16
- elsif /title/.match?(method)
17
- 't'
18
- else
19
- 's'
20
- end
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
- def query_params
24
- { query: { apikey: api_key, field.to_s => value.to_s }.merge(options) }
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 response
28
- @response ||= HTTParty.get(BASE_URI, query_params)
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 success?
32
- (response['Response'] || response['root']['response']) == 'True'
56
+ def _http_client
57
+ HTTParty
33
58
  end
34
59
  end
35
60
  end
@@ -0,0 +1,8 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'dry-struct'
4
+ require 'omdb/api/types/base'
5
+ require 'omdb/api/types/movie'
6
+ require 'omdb/api/types/movie_result'
7
+ require 'omdb/api/types/movies'
8
+ require 'omdb/api/types/error'
@@ -0,0 +1,11 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Omdb
4
+ module Api
5
+ module Types
6
+ class Base < Dry::Struct
7
+ transform_keys(&:to_sym)
8
+ end
9
+ end
10
+ end
11
+ 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
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Omdb
4
4
  module Api
5
- VERSION = '1.3.0'.freeze
5
+ VERSION = '2.0.0'
6
6
  end
7
7
  end
@@ -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 = 'A ruby interface for the OMDB API'
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 'httparty'
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: 1.3.0
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: 2019-04-19 00:00:00.000000000 Z
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: '0'
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: '0'
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: A ruby interface for the OMDB API
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
- rubyforge_project:
99
- rubygems_version: 2.6.13
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: []
@@ -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
@@ -1,16 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Omdb
4
- module Api
5
- class Error
6
- attr_reader :response
7
- :error
8
-
9
- def initialize(params)
10
- params.each_pair do |k, v|
11
- instance_variable_set("@#{k}", v)
12
- end
13
- end
14
- end
15
- end
16
- end
@@ -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