the_whos 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. metadata +2 -3
  3. data/lib/the_whos.rb +0 -103
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: bfd529a33d973fde62db77abf0268dd2168fb99e86e00364b56869d5e86821a9
4
- data.tar.gz: 45a925750f8a4913309891ae0489a71f2c7cdd416a32c2f59cbba607315ef2e7
3
+ metadata.gz: cd95eec1c0a3845af7bcf884e9022693a701a9a97688205947c847c9f84cdeba
4
+ data.tar.gz: 6b8ae647c2f6c993a03b349a62e33eaf137c83b7850ae40bfdf9f964b834dad6
5
5
  SHA512:
6
- metadata.gz: 4b690a81feac634e293fc0c64bfe104d5cc73f254d374f656b2e916e27c1ad7767ef5e1edcdf30d8269eae87fd7e72035ec91bcd05e68811a0699b281245d0fe
7
- data.tar.gz: 26c4c100e45b80b5ee44db7c204251c6be4069e9cb69d565ad2e0a71ad382b969138f7fd526806824d7f3289327c54ed5e4f9241f4f46478b93e11838bb146d7
6
+ metadata.gz: fbadc47b16fde1f47b6cb4a149069f553015d12e65cc6346c831d322555addfa7bfd94c12e313dc9625dd7a5579ee9acf9626a627495fb282e370b6bbfd390c9
7
+ data.tar.gz: 433e92edccc3f1a68e76089be90bfd7746c59a88c0a19b7610fe3a0124470bf77a19f0fbc1619a186261aed008ecae2b51e41b7d5fa4979dc17d439672ce5834
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: the_whos
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ramiro Eloisa
@@ -19,8 +19,7 @@ email: ram.eloisalg@egmail.com
19
19
  executables: []
20
20
  extensions: []
21
21
  extra_rdoc_files: []
22
- files:
23
- - lib/the_whos.rb
22
+ files: []
24
23
  homepage:
25
24
  licenses:
26
25
  - MIT
data/lib/the_whos.rb DELETED
@@ -1,103 +0,0 @@
1
- require_relative 'title'
2
- require_relative 'actor'
3
-
4
- class TheWhos
5
- @key_imdb = ARGV[0]
6
-
7
- def self.create(id)
8
- if id.chr == 't'
9
- return Title.new(id)
10
- elsif id.chr == 'n'
11
- return Actor.new(id)
12
- else
13
- return 'Error'
14
- end
15
- end
16
-
17
- def self.search_title(expression)
18
- expression = expression.gsub(' ', '@')
19
- url = "https://imdb-api.com/en/API/SearchTitle/#{@key_imdb}/#{expression}"
20
- response = RestClient.get url
21
- r_json = JSON.parse response.to_str
22
- arr_search = r_json['results'].to_a
23
- results = Array.new
24
- arr_search.size.times do |i|
25
- results << {id: "#{arr_search[i]['id']}", title: "#{arr_search[i]['title']}"}
26
- end
27
- return results
28
- end
29
-
30
- def self.search_actor(expression)
31
- expression = expression.gsub(' ', '@')
32
- url = "https://imdb-api.com/en/API/SearchName/#{@key_imdb}/#{expression}"
33
- response = RestClient.get url
34
- r_json = JSON.parse response.to_str
35
- arr_search = r_json['results'].to_a
36
- results = Array.new
37
- arr_search.size.times do |i|
38
- results << {id: "#{arr_search[i]['id']}", title: "#{arr_search[i]['title']}"}
39
- end
40
- return results
41
- end
42
-
43
- def self.match_title(title_a, title_b)
44
- if title_a.class == String
45
- title_a = Title.new(title_a)
46
- end
47
- if title_b.class == String
48
- title_b = Title.new(title_b)
49
- end
50
- match = Array.new
51
- title_a.fullcast.each do |actor_a|
52
- title_b.fullcast.each do |actor_b|
53
- if actor_a[:id] == actor_b[:id]
54
- match << "#{actor_a[:actor].to_s} (#{actor_a[:id]})"
55
- end
56
- end
57
- end
58
- if match.empty? == true
59
- return 'Not Match'
60
- else
61
- return match
62
- end
63
- end
64
-
65
- def self.match_actor(actor_a, actor_b)
66
- if actor_a.class == String
67
- actor_a = Actor.new(actor_a)
68
- end
69
- if actor_b.class == String
70
- actor_b = Actor.new(actor_b)
71
- end
72
- match = Array.new
73
- actor_a.cast.each do |title_a|
74
- actor_b.cast.each do |title_b|
75
- if title_a[:id] == title_b[:id]
76
- match << "#{title_a[:title]} (#{title_a[:id]})"
77
- end
78
- end
79
- end
80
- if match.empty? == true
81
- return 'Not Match'
82
- else
83
- return match
84
- end
85
- end
86
-
87
- def self.who(title, actor)
88
- if title.class == String
89
- title = Title.new(title)
90
- end
91
- if actor.class == String
92
- actor = Actor.new(actor)
93
- end
94
- title.fullcast.each do |cast|
95
- if cast[:id] == actor.id
96
- return cast[:character]
97
- end
98
- end
99
- return 'not appear'
100
- end
101
-
102
-
103
- end