tricorder 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (55) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +51 -0
  3. data/LICENSE +21 -0
  4. data/README.md +61 -0
  5. data/bin/tricorder +50 -0
  6. data/lib/dsl/operators/.rb +0 -0
  7. data/lib/dsl/operators/base_operators.rb +260 -0
  8. data/lib/dsl/operators/string.rb +9 -0
  9. data/lib/dsl/operators/tricorders.rb +68 -0
  10. data/lib/dsl/operators/tricorders/animal.rb +19 -0
  11. data/lib/dsl/operators/tricorders/astronomical_object.rb +19 -0
  12. data/lib/dsl/operators/tricorders/book.rb +19 -0
  13. data/lib/dsl/operators/tricorders/book_collection.rb +19 -0
  14. data/lib/dsl/operators/tricorders/book_series.rb +19 -0
  15. data/lib/dsl/operators/tricorders/character.rb +19 -0
  16. data/lib/dsl/operators/tricorders/comic_collection.rb +19 -0
  17. data/lib/dsl/operators/tricorders/comic_series.rb +19 -0
  18. data/lib/dsl/operators/tricorders/comic_strip.rb +19 -0
  19. data/lib/dsl/operators/tricorders/comics.rb +19 -0
  20. data/lib/dsl/operators/tricorders/company.rb +19 -0
  21. data/lib/dsl/operators/tricorders/conflict.rb +19 -0
  22. data/lib/dsl/operators/tricorders/element.rb +19 -0
  23. data/lib/dsl/operators/tricorders/episode.rb +19 -0
  24. data/lib/dsl/operators/tricorders/food.rb +19 -0
  25. data/lib/dsl/operators/tricorders/literature.rb +19 -0
  26. data/lib/dsl/operators/tricorders/location.rb +19 -0
  27. data/lib/dsl/operators/tricorders/magazine.rb +19 -0
  28. data/lib/dsl/operators/tricorders/magazine_series.rb +19 -0
  29. data/lib/dsl/operators/tricorders/material.rb +19 -0
  30. data/lib/dsl/operators/tricorders/medical_condition.rb +19 -0
  31. data/lib/dsl/operators/tricorders/movie.rb +19 -0
  32. data/lib/dsl/operators/tricorders/occupation.rb +19 -0
  33. data/lib/dsl/operators/tricorders/organization.rb +19 -0
  34. data/lib/dsl/operators/tricorders/performer.rb +19 -0
  35. data/lib/dsl/operators/tricorders/season.rb +19 -0
  36. data/lib/dsl/operators/tricorders/series.rb +19 -0
  37. data/lib/dsl/operators/tricorders/soundtrack.rb +19 -0
  38. data/lib/dsl/operators/tricorders/spacecraft.rb +19 -0
  39. data/lib/dsl/operators/tricorders/spacecraft_class.rb +19 -0
  40. data/lib/dsl/operators/tricorders/species.rb +19 -0
  41. data/lib/dsl/operators/tricorders/staff.rb +19 -0
  42. data/lib/dsl/operators/tricorders/technology.rb +19 -0
  43. data/lib/dsl/operators/tricorders/title.rb +19 -0
  44. data/lib/dsl/operators/tricorders/trading_card.rb +19 -0
  45. data/lib/dsl/operators/tricorders/trading_card_deck.rb +19 -0
  46. data/lib/dsl/operators/tricorders/trading_card_set.rb +19 -0
  47. data/lib/dsl/operators/tricorders/video_game.rb +19 -0
  48. data/lib/dsl/operators/tricorders/video_release.rb +19 -0
  49. data/lib/dsl/operators/tricorders/weapon.rb +19 -0
  50. data/lib/dsl/tricorder.rb +10 -0
  51. data/lib/dsl/tricorder_dsl.rb +23 -0
  52. data/lib/tricorder.rb +18 -0
  53. data/lib/version.rb +9 -0
  54. data/tricorder.gemspec +35 -0
  55. metadata +169 -0
@@ -0,0 +1,9 @@
1
+ class String
2
+ def underscore
3
+ gsub(/::/, '/')
4
+ .gsub(/([A-Z]+)([A-Z][a-z])/, '\1_\2')
5
+ .gsub(/([a-z\d])([A-Z])/, '\1_\2')
6
+ .tr('-', '_')
7
+ .downcase
8
+ end
9
+ end
@@ -0,0 +1,68 @@
1
+ Dir[File.join(File.dirname(__FILE__), 'tricorders/**/*.rb')].sort.reverse.each { |tricorder| require_relative tricorder }
2
+
3
+ module Tricorders
4
+ TRICORDERS = %i[animal comic_strip
5
+ element material
6
+ season technology
7
+ astronomical_object comics
8
+ episode medical_condition
9
+ series title
10
+ book food movie
11
+ soundtrack trading_card
12
+ book_collection company
13
+ occupation
14
+ spacecraft trading_card_deck
15
+ book_series conflict
16
+ literature organization
17
+ spacecraft_class trading_card_set
18
+ character
19
+ location performer
20
+ video_game
21
+ comic_collection
22
+ magazine platform
23
+ species video_release
24
+ comic_series
25
+ magazine_series reference
26
+ staff weapon].freeze
27
+
28
+ include Animal
29
+ include AstronomicalObject
30
+ include Book
31
+ include BookCollection
32
+ include BookSeries
33
+ include Characters
34
+ include ComicCollection
35
+ include ComicSeries
36
+ include ComicStrip
37
+ include Comics
38
+ include Company
39
+ include Conflict
40
+ include Element
41
+ include Episode
42
+ include Food
43
+ include Literature
44
+ include Location
45
+ include Magazine
46
+ include MagazineSeries
47
+ include Material
48
+ include MedicalCondition
49
+ include Movie
50
+ include Occupation
51
+ include Organization
52
+ include Performer
53
+ include Season
54
+ include Series
55
+ include Soundtrack
56
+ include Spacecraft
57
+ include SpacecraftClass
58
+ include Species
59
+ include Staff
60
+ include Technology
61
+ include Title
62
+ include TradingCard
63
+ include TradingCardDeck
64
+ include TradingCardSet
65
+ include VideoGame
66
+ include VideoRelease
67
+ include Weapon
68
+ end
@@ -0,0 +1,19 @@
1
+ require_relative '../../tricorder'
2
+ require_relative '../../tricorder_dsl'
3
+
4
+ module Animal
5
+ RESOURCE_NAME = 'animal'.freeze
6
+ COLLECTION_NAME = 'animals'.freeze
7
+ NAME = RESOURCE_NAME.underscore
8
+ API_PATH = Tricorder::BASE_URL + "/#{RESOURCE_NAME}"
9
+
10
+ private_constant :API_PATH, :RESOURCE_NAME, :COLLECTION_NAME, :NAME
11
+
12
+ define_method("search_#{NAME}".to_sym) do
13
+ set_tricorder(NAME.to_sym)
14
+ set_collection(COLLECTION_NAME)
15
+ set_path(API_PATH)
16
+ search
17
+ self
18
+ end
19
+ end
@@ -0,0 +1,19 @@
1
+ require_relative '../../tricorder'
2
+ require_relative '../../tricorder_dsl'
3
+
4
+ module AstronomicalObject
5
+ RESOURCE_NAME = 'astronomicalObject'.freeze
6
+ COLLECTION_NAME = 'astronomicalObjects'.freeze
7
+ NAME = RESOURCE_NAME.underscore
8
+ API_PATH = Tricorder::BASE_URL + "/#{RESOURCE_NAME}"
9
+
10
+ private_constant :API_PATH, :RESOURCE_NAME, :COLLECTION_NAME, :NAME
11
+
12
+ define_method("search_#{NAME}".to_sym) do
13
+ set_tricorder(NAME.to_sym)
14
+ set_collection(COLLECTION_NAME)
15
+ set_path(API_PATH)
16
+ search
17
+ self
18
+ end
19
+ end
@@ -0,0 +1,19 @@
1
+ require_relative '../../tricorder'
2
+ require_relative '../../tricorder_dsl'
3
+
4
+ module Book
5
+ RESOURCE_NAME = 'book'.freeze
6
+ COLLECTION_NAME = 'books'.freeze
7
+ NAME = RESOURCE_NAME.underscore
8
+ API_PATH = Tricorder::BASE_URL + "/#{RESOURCE_NAME}"
9
+
10
+ private_constant :API_PATH, :RESOURCE_NAME, :COLLECTION_NAME, :NAME
11
+
12
+ define_method("search_#{NAME}".to_sym) do
13
+ set_tricorder(NAME.to_sym)
14
+ set_collection(COLLECTION_NAME)
15
+ set_path(API_PATH)
16
+ search
17
+ self
18
+ end
19
+ end
@@ -0,0 +1,19 @@
1
+ require_relative '../../tricorder'
2
+ require_relative '../../tricorder_dsl'
3
+
4
+ module BookCollection
5
+ RESOURCE_NAME = 'bookCollection'.freeze
6
+ COLLECTION_NAME = 'bookCollections'.freeze
7
+ NAME = RESOURCE_NAME.underscore
8
+ API_PATH = Tricorder::BASE_URL + "/#{RESOURCE_NAME}"
9
+
10
+ private_constant :API_PATH, :RESOURCE_NAME, :COLLECTION_NAME, :NAME
11
+
12
+ define_method("search_#{NAME}".to_sym) do
13
+ set_tricorder(NAME.to_sym)
14
+ set_collection(COLLECTION_NAME)
15
+ set_path(API_PATH)
16
+ search
17
+ self
18
+ end
19
+ end
@@ -0,0 +1,19 @@
1
+ require_relative '../../tricorder'
2
+ require_relative '../../tricorder_dsl'
3
+
4
+ module BookSeries
5
+ RESOURCE_NAME = 'bookSeries'.freeze
6
+ COLLECTION_NAME = 'bookSeries'.freeze
7
+ NAME = RESOURCE_NAME.underscore
8
+ API_PATH = Tricorder::BASE_URL + "/#{RESOURCE_NAME}"
9
+
10
+ private_constant :API_PATH, :RESOURCE_NAME, :COLLECTION_NAME, :NAME
11
+
12
+ define_method("search_#{NAME}".to_sym) do
13
+ set_tricorder(NAME.to_sym)
14
+ set_collection(COLLECTION_NAME)
15
+ set_path(API_PATH)
16
+ search
17
+ self
18
+ end
19
+ end
@@ -0,0 +1,19 @@
1
+ require_relative '../../tricorder'
2
+ require_relative '../../tricorder_dsl'
3
+
4
+ module Characters
5
+ RESOURCE_NAME = 'character'.freeze
6
+ COLLECTION_NAME = 'characters'.freeze
7
+ NAME = RESOURCE_NAME.underscore
8
+ API_PATH = Tricorder::BASE_URL + "/#{RESOURCE_NAME}"
9
+
10
+ private_constant :API_PATH, :RESOURCE_NAME, :COLLECTION_NAME, :NAME
11
+
12
+ define_method("search_#{NAME}".to_sym) do
13
+ set_tricorder(NAME.to_sym)
14
+ set_collection(COLLECTION_NAME)
15
+ set_path(API_PATH)
16
+ search
17
+ self
18
+ end
19
+ end
@@ -0,0 +1,19 @@
1
+ require_relative '../../tricorder'
2
+ require_relative '../../tricorder_dsl'
3
+
4
+ module ComicCollection
5
+ RESOURCE_NAME = 'comicCollection'.freeze
6
+ COLLECTION_NAME = 'comicCollections'.freeze
7
+ NAME = RESOURCE_NAME.underscore
8
+ API_PATH = Tricorder::BASE_URL + "/#{RESOURCE_NAME}"
9
+
10
+ private_constant :API_PATH, :RESOURCE_NAME, :COLLECTION_NAME, :NAME
11
+
12
+ define_method("search_#{NAME}".to_sym) do
13
+ set_tricorder(NAME.to_sym)
14
+ set_collection(COLLECTION_NAME)
15
+ set_path(API_PATH)
16
+ search
17
+ self
18
+ end
19
+ end
@@ -0,0 +1,19 @@
1
+ require_relative '../../tricorder'
2
+ require_relative '../../tricorder_dsl'
3
+
4
+ module ComicSeries
5
+ RESOURCE_NAME = 'comicSeries'.freeze
6
+ COLLECTION_NAME = 'comicSeries'.freeze
7
+ NAME = RESOURCE_NAME.underscore
8
+ API_PATH = Tricorder::BASE_URL + "/#{RESOURCE_NAME}"
9
+
10
+ private_constant :API_PATH, :RESOURCE_NAME, :COLLECTION_NAME, :NAME
11
+
12
+ define_method("search_#{NAME}".to_sym) do
13
+ set_tricorder(NAME.to_sym)
14
+ set_collection(COLLECTION_NAME)
15
+ set_path(API_PATH)
16
+ search
17
+ self
18
+ end
19
+ end
@@ -0,0 +1,19 @@
1
+ require_relative '../../tricorder'
2
+ require_relative '../../tricorder_dsl'
3
+
4
+ module ComicStrip
5
+ RESOURCE_NAME = 'comicStrip'.freeze
6
+ COLLECTION_NAME = 'comicStrips'.freeze
7
+ NAME = RESOURCE_NAME.underscore
8
+ API_PATH = Tricorder::BASE_URL + "/#{RESOURCE_NAME}"
9
+
10
+ private_constant :API_PATH, :RESOURCE_NAME, :COLLECTION_NAME, :NAME
11
+
12
+ define_method("search_#{NAME}".to_sym) do
13
+ set_tricorder(NAME.to_sym)
14
+ set_collection(COLLECTION_NAME)
15
+ set_path(API_PATH)
16
+ search
17
+ self
18
+ end
19
+ end
@@ -0,0 +1,19 @@
1
+ require_relative '../../tricorder'
2
+ require_relative '../../tricorder_dsl'
3
+
4
+ module Comics
5
+ RESOURCE_NAME = 'comics'.freeze
6
+ COLLECTION_NAME = 'comics'.freeze
7
+ NAME = RESOURCE_NAME.underscore
8
+ API_PATH = Tricorder::BASE_URL + "/#{RESOURCE_NAME}"
9
+
10
+ private_constant :API_PATH, :RESOURCE_NAME, :COLLECTION_NAME, :NAME
11
+
12
+ define_method("search_#{NAME}".to_sym) do
13
+ set_tricorder(NAME.to_sym)
14
+ set_collection(COLLECTION_NAME)
15
+ set_path(API_PATH)
16
+ search
17
+ self
18
+ end
19
+ end
@@ -0,0 +1,19 @@
1
+ require_relative '../../tricorder'
2
+ require_relative '../../tricorder_dsl'
3
+
4
+ module Company
5
+ RESOURCE_NAME = 'company'.freeze
6
+ COLLECTION_NAME = 'companies'.freeze
7
+ NAME = RESOURCE_NAME.underscore
8
+ API_PATH = Tricorder::BASE_URL + "/#{RESOURCE_NAME}"
9
+
10
+ private_constant :API_PATH, :RESOURCE_NAME, :COLLECTION_NAME, :NAME
11
+
12
+ define_method("search_#{NAME}".to_sym) do
13
+ set_tricorder(NAME.to_sym)
14
+ set_collection(COLLECTION_NAME)
15
+ set_path(API_PATH)
16
+ search
17
+ self
18
+ end
19
+ end
@@ -0,0 +1,19 @@
1
+ require_relative '../../tricorder'
2
+ require_relative '../../tricorder_dsl'
3
+
4
+ module Conflict
5
+ RESOURCE_NAME = 'conflict'.freeze
6
+ COLLECTION_NAME = 'conflicts'.freeze
7
+ NAME = RESOURCE_NAME.underscore
8
+ API_PATH = Tricorder::BASE_URL + "/#{RESOURCE_NAME}"
9
+
10
+ private_constant :API_PATH, :RESOURCE_NAME, :COLLECTION_NAME, :NAME
11
+
12
+ define_method("search_#{NAME}".to_sym) do
13
+ set_tricorder(NAME.to_sym)
14
+ set_collection(COLLECTION_NAME)
15
+ set_path(API_PATH)
16
+ search
17
+ self
18
+ end
19
+ end
@@ -0,0 +1,19 @@
1
+ require_relative '../../tricorder'
2
+ require_relative '../../tricorder_dsl'
3
+
4
+ module Element
5
+ RESOURCE_NAME = 'element'.freeze
6
+ COLLECTION_NAME = 'elements'.freeze
7
+ NAME = RESOURCE_NAME.underscore
8
+ API_PATH = Tricorder::BASE_URL + "/#{RESOURCE_NAME}"
9
+
10
+ private_constant :API_PATH, :RESOURCE_NAME, :COLLECTION_NAME, :NAME
11
+
12
+ define_method("search_#{NAME}".to_sym) do
13
+ set_tricorder(NAME.to_sym)
14
+ set_collection(COLLECTION_NAME)
15
+ set_path(API_PATH)
16
+ search
17
+ self
18
+ end
19
+ end
@@ -0,0 +1,19 @@
1
+ require_relative '../../tricorder'
2
+ require_relative '../../tricorder_dsl'
3
+
4
+ module Episode
5
+ RESOURCE_NAME = 'episode'.freeze
6
+ COLLECTION_NAME = 'episodes'.freeze
7
+ NAME = RESOURCE_NAME.underscore
8
+ API_PATH = Tricorder::BASE_URL + "/#{RESOURCE_NAME}"
9
+
10
+ private_constant :API_PATH, :RESOURCE_NAME, :COLLECTION_NAME, :NAME
11
+
12
+ define_method("search_#{NAME}".to_sym) do
13
+ set_tricorder(NAME.to_sym)
14
+ set_collection(COLLECTION_NAME)
15
+ set_path(API_PATH)
16
+ search
17
+ self
18
+ end
19
+ end
@@ -0,0 +1,19 @@
1
+ require_relative '../../tricorder'
2
+ require_relative '../../tricorder_dsl'
3
+
4
+ module Food
5
+ RESOURCE_NAME = 'food'.freeze
6
+ COLLECTION_NAME = 'foods'.freeze
7
+ NAME = RESOURCE_NAME.underscore
8
+ API_PATH = Tricorder::BASE_URL + "/#{RESOURCE_NAME}"
9
+
10
+ private_constant :API_PATH, :RESOURCE_NAME, :COLLECTION_NAME, :NAME
11
+
12
+ define_method("search_#{NAME}".to_sym) do
13
+ set_tricorder(NAME.to_sym)
14
+ set_collection(COLLECTION_NAME)
15
+ set_path(API_PATH)
16
+ search
17
+ self
18
+ end
19
+ end
@@ -0,0 +1,19 @@
1
+ require_relative '../../tricorder'
2
+ require_relative '../../tricorder_dsl'
3
+
4
+ module Literature
5
+ RESOURCE_NAME = 'literature'.freeze
6
+ COLLECTION_NAME = 'literature'.freeze
7
+ NAME = RESOURCE_NAME.underscore
8
+ API_PATH = Tricorder::BASE_URL + "/#{RESOURCE_NAME}"
9
+
10
+ private_constant :API_PATH, :RESOURCE_NAME, :COLLECTION_NAME, :NAME
11
+
12
+ define_method("search_#{NAME}".to_sym) do
13
+ set_tricorder(NAME.to_sym)
14
+ set_collection(COLLECTION_NAME)
15
+ set_path(API_PATH)
16
+ search
17
+ self
18
+ end
19
+ end
@@ -0,0 +1,19 @@
1
+ require_relative '../../tricorder'
2
+ require_relative '../../tricorder_dsl'
3
+
4
+ module Location
5
+ RESOURCE_NAME = 'location'.freeze
6
+ COLLECTION_NAME = 'locations'.freeze
7
+ NAME = RESOURCE_NAME.underscore
8
+ API_PATH = Tricorder::BASE_URL + "/#{RESOURCE_NAME}"
9
+
10
+ private_constant :API_PATH, :RESOURCE_NAME, :COLLECTION_NAME, :NAME
11
+
12
+ define_method("search_#{NAME}".to_sym) do
13
+ set_tricorder(NAME.to_sym)
14
+ set_collection(COLLECTION_NAME)
15
+ set_path(API_PATH)
16
+ search
17
+ self
18
+ end
19
+ end
@@ -0,0 +1,19 @@
1
+ require_relative '../../tricorder'
2
+ require_relative '../../tricorder_dsl'
3
+
4
+ module Magazine
5
+ RESOURCE_NAME = 'magazine'.freeze
6
+ COLLECTION_NAME = 'magazines'.freeze
7
+ NAME = RESOURCE_NAME.underscore
8
+ API_PATH = Tricorder::BASE_URL + "/#{RESOURCE_NAME}"
9
+
10
+ private_constant :API_PATH, :RESOURCE_NAME, :COLLECTION_NAME, :NAME
11
+
12
+ define_method("search_#{NAME}".to_sym) do
13
+ set_tricorder(NAME.to_sym)
14
+ set_collection(COLLECTION_NAME)
15
+ set_path(API_PATH)
16
+ search
17
+ self
18
+ end
19
+ end