suggestgrid 0.1.32.rc2 → 0.2.0.rc4

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.
Files changed (56) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +1 -1
  3. data/lib/{suggest_grid → suggestgrid}/api_helper.rb +80 -56
  4. data/lib/{suggest_grid → suggestgrid}/configuration.rb +1 -2
  5. data/lib/{suggest_grid → suggestgrid}/controllers/action_controller.rb +17 -17
  6. data/lib/{suggest_grid → suggestgrid}/controllers/base_controller.rb +5 -5
  7. data/lib/{suggest_grid → suggestgrid}/controllers/metadata_controller.rb +22 -22
  8. data/lib/{suggest_grid → suggestgrid}/controllers/recommendation_controller.rb +8 -8
  9. data/lib/{suggest_grid → suggestgrid}/controllers/similarity_controller.rb +8 -8
  10. data/lib/{suggest_grid → suggestgrid}/controllers/type_controller.rb +10 -10
  11. data/lib/{suggest_grid/exceptions/delete_error_response_exception.rb → suggestgrid/exceptions/delete_error_response_error_exception.rb} +9 -9
  12. data/lib/{suggest_grid/exceptions/detailed_error_response_exception.rb → suggestgrid/exceptions/detailed_error_response_error_exception.rb} +7 -7
  13. data/lib/{suggest_grid/exceptions/error_response_exception.rb → suggestgrid/exceptions/error_response_error_exception.rb} +6 -6
  14. data/lib/{suggest_grid/exceptions/limit_exceeded_error_response_exception.rb → suggestgrid/exceptions/limit_exceeded_error_response_error_exception.rb} +8 -8
  15. data/lib/{suggest_grid → suggestgrid}/http/faraday_client.rb +5 -7
  16. data/lib/{suggest_grid → suggestgrid}/http/http_call_back.rb +4 -4
  17. data/lib/{suggest_grid → suggestgrid}/http/http_client.rb +3 -3
  18. data/lib/{suggest_grid → suggestgrid}/http/http_context.rb +1 -1
  19. data/lib/{suggest_grid → suggestgrid}/http/http_method_enum.rb +1 -1
  20. data/lib/{suggest_grid → suggestgrid}/http/http_request.rb +4 -4
  21. data/lib/{suggest_grid → suggestgrid}/http/http_response.rb +2 -2
  22. data/lib/{suggest_grid → suggestgrid}/models/action.rb +22 -32
  23. data/lib/suggestgrid/models/actions_response.rb +56 -0
  24. data/lib/{suggest_grid → suggestgrid}/models/base_model.rb +0 -17
  25. data/lib/suggestgrid/models/bulk_post_error.rb +51 -0
  26. data/lib/suggestgrid/models/bulk_post_response.rb +47 -0
  27. data/lib/suggestgrid/models/delete_success_response.rb +60 -0
  28. data/lib/{suggest_grid → suggestgrid}/models/get_recommended_items_body.rb +42 -52
  29. data/lib/{suggest_grid → suggestgrid}/models/get_recommended_users_body.rb +42 -52
  30. data/lib/{suggest_grid → suggestgrid}/models/get_similar_items_body.rb +34 -44
  31. data/lib/{suggest_grid → suggestgrid}/models/get_similar_users_body.rb +34 -44
  32. data/lib/suggestgrid/models/get_type_response.rb +33 -0
  33. data/lib/suggestgrid/models/get_types_response.rb +33 -0
  34. data/lib/suggestgrid/models/items_response.rb +56 -0
  35. data/lib/suggestgrid/models/message_response.rb +33 -0
  36. data/lib/suggestgrid/models/metadata.rb +49 -0
  37. data/lib/suggestgrid/models/type_request_body.rb +33 -0
  38. data/lib/suggestgrid/models/users_response.rb +56 -0
  39. data/lib/suggestgrid.rb +55 -0
  40. data/spec/swagger.yaml +3 -8
  41. metadata +45 -45
  42. data/lib/suggest_grid/models/actions_response.rb +0 -66
  43. data/lib/suggest_grid/models/bulk_post_error.rb +0 -61
  44. data/lib/suggest_grid/models/bulk_post_response.rb +0 -57
  45. data/lib/suggest_grid/models/delete_success_response.rb +0 -70
  46. data/lib/suggest_grid/models/get_type_response.rb +0 -43
  47. data/lib/suggest_grid/models/get_types_response.rb +0 -43
  48. data/lib/suggest_grid/models/items_response.rb +0 -66
  49. data/lib/suggest_grid/models/message_response.rb +0 -43
  50. data/lib/suggest_grid/models/metadata.rb +0 -43
  51. data/lib/suggest_grid/models/type_request_body.rb +0 -43
  52. data/lib/suggest_grid/models/users_response.rb +0 -66
  53. data/lib/suggest_grid.rb +0 -55
  54. /data/lib/{suggest_grid → suggestgrid}/exceptions/api_exception.rb +0 -0
  55. /data/lib/{suggest_grid → suggestgrid}/http/auth/basic_auth.rb +0 -0
  56. /data/lib/{suggest_grid/suggest_grid_client.rb → suggestgrid/suggestgrid_client.rb} +0 -0
@@ -50,21 +50,21 @@ module SuggestGrid
50
50
 
51
51
  # A mapping from model property names to API property names
52
52
  def self.names
53
- if @hash.nil?
54
- @hash = {}
55
- @hash["type"] = "type"
56
- @hash["types"] = "types"
57
- @hash["user_id"] = "user_id"
58
- @hash["user_ids"] = "user_ids"
59
- @hash["from"] = "from"
60
- @hash["size"] = "size"
61
- @hash["similar_item_id"] = "similar_item_id"
62
- @hash["similar_item_ids"] = "similar_item_ids"
63
- @hash["fields"] = "fields"
64
- @hash["filter"] = "filter"
65
- @hash["except"] = "except"
53
+ if @_hash.nil?
54
+ @_hash = {}
55
+ @_hash["type"] = "type"
56
+ @_hash["types"] = "types"
57
+ @_hash["user_id"] = "user_id"
58
+ @_hash["user_ids"] = "user_ids"
59
+ @_hash["from"] = "from"
60
+ @_hash["size"] = "size"
61
+ @_hash["similar_item_id"] = "similar_item_id"
62
+ @_hash["similar_item_ids"] = "similar_item_ids"
63
+ @_hash["fields"] = "fields"
64
+ @_hash["filter"] = "filter"
65
+ @_hash["except"] = "except"
66
66
  end
67
- @hash
67
+ @_hash
68
68
  end
69
69
 
70
70
  def initialize(type = nil,
@@ -77,8 +77,7 @@ module SuggestGrid
77
77
  similar_item_ids = nil,
78
78
  fields = nil,
79
79
  filter = nil,
80
- except = nil,
81
- additional_properties = {})
80
+ except = nil)
82
81
  @type = type
83
82
  @types = types
84
83
  @user_id = user_id
@@ -90,46 +89,37 @@ module SuggestGrid
90
89
  @fields = fields
91
90
  @filter = filter
92
91
  @except = except
93
-
94
- # Add additional model properties to the instance
95
- additional_properties.each {|name, value| instance_variable_set("@#{name}", value)}
96
92
  end
97
93
 
98
94
  # Creates an instance of the object from a hash
99
95
  def self.from_hash(hash)
100
- if hash == nil
101
- nil
102
- else
103
- # Extract variables from the hash
104
- type = hash["type"]
105
- types = hash["types"]
106
- user_id = hash["user_id"]
107
- user_ids = hash["user_ids"]
108
- from = hash["from"]
109
- size = hash["size"]
110
- similar_item_id = hash["similar_item_id"]
111
- similar_item_ids = hash["similar_item_ids"]
112
- fields = hash["fields"]
113
- filter = hash["filter"]
114
- except = hash["except"]
115
-
116
- # Clean out expected properties from Hash
117
- names.values.each {|k| hash.delete(k)}
118
-
119
- # Create object from extracted values
120
- GetRecommendedItemsBody.new(type,
121
- types,
122
- user_id,
123
- user_ids,
124
- from,
125
- size,
126
- similar_item_id,
127
- similar_item_ids,
128
- fields,
129
- filter,
130
- except,
131
- hash)
132
- end
96
+ return nil unless hash
97
+
98
+ # Extract variables from the hash
99
+ type = hash['type']
100
+ types = hash['types']
101
+ user_id = hash['user_id']
102
+ user_ids = hash['user_ids']
103
+ from = hash['from']
104
+ size = hash['size']
105
+ similar_item_id = hash['similar_item_id']
106
+ similar_item_ids = hash['similar_item_ids']
107
+ fields = hash['fields']
108
+ filter = hash['filter']
109
+ except = hash['except']
110
+
111
+ # Create object from extracted values
112
+ GetRecommendedItemsBody.new(type,
113
+ types,
114
+ user_id,
115
+ user_ids,
116
+ from,
117
+ size,
118
+ similar_item_id,
119
+ similar_item_ids,
120
+ fields,
121
+ filter,
122
+ except)
133
123
  end
134
124
  end
135
125
  end
@@ -50,21 +50,21 @@ module SuggestGrid
50
50
 
51
51
  # A mapping from model property names to API property names
52
52
  def self.names
53
- if @hash.nil?
54
- @hash = {}
55
- @hash["type"] = "type"
56
- @hash["types"] = "types"
57
- @hash["item_id"] = "item_id"
58
- @hash["item_ids"] = "item_ids"
59
- @hash["from"] = "from"
60
- @hash["size"] = "size"
61
- @hash["similar_user_id"] = "similar_user_id"
62
- @hash["similar_user_ids"] = "similar_user_ids"
63
- @hash["fields"] = "fields"
64
- @hash["filter"] = "filter"
65
- @hash["except"] = "except"
53
+ if @_hash.nil?
54
+ @_hash = {}
55
+ @_hash["type"] = "type"
56
+ @_hash["types"] = "types"
57
+ @_hash["item_id"] = "item_id"
58
+ @_hash["item_ids"] = "item_ids"
59
+ @_hash["from"] = "from"
60
+ @_hash["size"] = "size"
61
+ @_hash["similar_user_id"] = "similar_user_id"
62
+ @_hash["similar_user_ids"] = "similar_user_ids"
63
+ @_hash["fields"] = "fields"
64
+ @_hash["filter"] = "filter"
65
+ @_hash["except"] = "except"
66
66
  end
67
- @hash
67
+ @_hash
68
68
  end
69
69
 
70
70
  def initialize(type = nil,
@@ -77,8 +77,7 @@ module SuggestGrid
77
77
  similar_user_ids = nil,
78
78
  fields = nil,
79
79
  filter = nil,
80
- except = nil,
81
- additional_properties = {})
80
+ except = nil)
82
81
  @type = type
83
82
  @types = types
84
83
  @item_id = item_id
@@ -90,46 +89,37 @@ module SuggestGrid
90
89
  @fields = fields
91
90
  @filter = filter
92
91
  @except = except
93
-
94
- # Add additional model properties to the instance
95
- additional_properties.each {|name, value| instance_variable_set("@#{name}", value)}
96
92
  end
97
93
 
98
94
  # Creates an instance of the object from a hash
99
95
  def self.from_hash(hash)
100
- if hash == nil
101
- nil
102
- else
103
- # Extract variables from the hash
104
- type = hash["type"]
105
- types = hash["types"]
106
- item_id = hash["item_id"]
107
- item_ids = hash["item_ids"]
108
- from = hash["from"]
109
- size = hash["size"]
110
- similar_user_id = hash["similar_user_id"]
111
- similar_user_ids = hash["similar_user_ids"]
112
- fields = hash["fields"]
113
- filter = hash["filter"]
114
- except = hash["except"]
115
-
116
- # Clean out expected properties from Hash
117
- names.values.each {|k| hash.delete(k)}
118
-
119
- # Create object from extracted values
120
- GetRecommendedUsersBody.new(type,
121
- types,
122
- item_id,
123
- item_ids,
124
- from,
125
- size,
126
- similar_user_id,
127
- similar_user_ids,
128
- fields,
129
- filter,
130
- except,
131
- hash)
132
- end
96
+ return nil unless hash
97
+
98
+ # Extract variables from the hash
99
+ type = hash['type']
100
+ types = hash['types']
101
+ item_id = hash['item_id']
102
+ item_ids = hash['item_ids']
103
+ from = hash['from']
104
+ size = hash['size']
105
+ similar_user_id = hash['similar_user_id']
106
+ similar_user_ids = hash['similar_user_ids']
107
+ fields = hash['fields']
108
+ filter = hash['filter']
109
+ except = hash['except']
110
+
111
+ # Create object from extracted values
112
+ GetRecommendedUsersBody.new(type,
113
+ types,
114
+ item_id,
115
+ item_ids,
116
+ from,
117
+ size,
118
+ similar_user_id,
119
+ similar_user_ids,
120
+ fields,
121
+ filter,
122
+ except)
133
123
  end
134
124
  end
135
125
  end
@@ -41,19 +41,19 @@ module SuggestGrid
41
41
 
42
42
  # A mapping from model property names to API property names
43
43
  def self.names
44
- if @hash.nil?
45
- @hash = {}
46
- @hash["type"] = "type"
47
- @hash["types"] = "types"
48
- @hash["item_id"] = "item_id"
49
- @hash["item_ids"] = "item_ids"
50
- @hash["from"] = "from"
51
- @hash["size"] = "size"
52
- @hash["fields"] = "fields"
53
- @hash["filter"] = "filter"
54
- @hash["except"] = "except"
44
+ if @_hash.nil?
45
+ @_hash = {}
46
+ @_hash["type"] = "type"
47
+ @_hash["types"] = "types"
48
+ @_hash["item_id"] = "item_id"
49
+ @_hash["item_ids"] = "item_ids"
50
+ @_hash["from"] = "from"
51
+ @_hash["size"] = "size"
52
+ @_hash["fields"] = "fields"
53
+ @_hash["filter"] = "filter"
54
+ @_hash["except"] = "except"
55
55
  end
56
- @hash
56
+ @_hash
57
57
  end
58
58
 
59
59
  def initialize(type = nil,
@@ -64,8 +64,7 @@ module SuggestGrid
64
64
  size = nil,
65
65
  fields = nil,
66
66
  filter = nil,
67
- except = nil,
68
- additional_properties = {})
67
+ except = nil)
69
68
  @type = type
70
69
  @types = types
71
70
  @item_id = item_id
@@ -75,42 +74,33 @@ module SuggestGrid
75
74
  @fields = fields
76
75
  @filter = filter
77
76
  @except = except
78
-
79
- # Add additional model properties to the instance
80
- additional_properties.each {|name, value| instance_variable_set("@#{name}", value)}
81
77
  end
82
78
 
83
79
  # Creates an instance of the object from a hash
84
80
  def self.from_hash(hash)
85
- if hash == nil
86
- nil
87
- else
88
- # Extract variables from the hash
89
- type = hash["type"]
90
- types = hash["types"]
91
- item_id = hash["item_id"]
92
- item_ids = hash["item_ids"]
93
- from = hash["from"]
94
- size = hash["size"]
95
- fields = hash["fields"]
96
- filter = hash["filter"]
97
- except = hash["except"]
81
+ return nil unless hash
98
82
 
99
- # Clean out expected properties from Hash
100
- names.values.each {|k| hash.delete(k)}
83
+ # Extract variables from the hash
84
+ type = hash['type']
85
+ types = hash['types']
86
+ item_id = hash['item_id']
87
+ item_ids = hash['item_ids']
88
+ from = hash['from']
89
+ size = hash['size']
90
+ fields = hash['fields']
91
+ filter = hash['filter']
92
+ except = hash['except']
101
93
 
102
- # Create object from extracted values
103
- GetSimilarItemsBody.new(type,
104
- types,
105
- item_id,
106
- item_ids,
107
- from,
108
- size,
109
- fields,
110
- filter,
111
- except,
112
- hash)
113
- end
94
+ # Create object from extracted values
95
+ GetSimilarItemsBody.new(type,
96
+ types,
97
+ item_id,
98
+ item_ids,
99
+ from,
100
+ size,
101
+ fields,
102
+ filter,
103
+ except)
114
104
  end
115
105
  end
116
106
  end
@@ -41,19 +41,19 @@ module SuggestGrid
41
41
 
42
42
  # A mapping from model property names to API property names
43
43
  def self.names
44
- if @hash.nil?
45
- @hash = {}
46
- @hash["type"] = "type"
47
- @hash["types"] = "types"
48
- @hash["user_id"] = "user_id"
49
- @hash["user_ids"] = "user_ids"
50
- @hash["from"] = "from"
51
- @hash["size"] = "size"
52
- @hash["fields"] = "fields"
53
- @hash["filter"] = "filter"
54
- @hash["except"] = "except"
44
+ if @_hash.nil?
45
+ @_hash = {}
46
+ @_hash["type"] = "type"
47
+ @_hash["types"] = "types"
48
+ @_hash["user_id"] = "user_id"
49
+ @_hash["user_ids"] = "user_ids"
50
+ @_hash["from"] = "from"
51
+ @_hash["size"] = "size"
52
+ @_hash["fields"] = "fields"
53
+ @_hash["filter"] = "filter"
54
+ @_hash["except"] = "except"
55
55
  end
56
- @hash
56
+ @_hash
57
57
  end
58
58
 
59
59
  def initialize(type = nil,
@@ -64,8 +64,7 @@ module SuggestGrid
64
64
  size = nil,
65
65
  fields = nil,
66
66
  filter = nil,
67
- except = nil,
68
- additional_properties = {})
67
+ except = nil)
69
68
  @type = type
70
69
  @types = types
71
70
  @user_id = user_id
@@ -75,42 +74,33 @@ module SuggestGrid
75
74
  @fields = fields
76
75
  @filter = filter
77
76
  @except = except
78
-
79
- # Add additional model properties to the instance
80
- additional_properties.each {|name, value| instance_variable_set("@#{name}", value)}
81
77
  end
82
78
 
83
79
  # Creates an instance of the object from a hash
84
80
  def self.from_hash(hash)
85
- if hash == nil
86
- nil
87
- else
88
- # Extract variables from the hash
89
- type = hash["type"]
90
- types = hash["types"]
91
- user_id = hash["user_id"]
92
- user_ids = hash["user_ids"]
93
- from = hash["from"]
94
- size = hash["size"]
95
- fields = hash["fields"]
96
- filter = hash["filter"]
97
- except = hash["except"]
81
+ return nil unless hash
98
82
 
99
- # Clean out expected properties from Hash
100
- names.values.each {|k| hash.delete(k)}
83
+ # Extract variables from the hash
84
+ type = hash['type']
85
+ types = hash['types']
86
+ user_id = hash['user_id']
87
+ user_ids = hash['user_ids']
88
+ from = hash['from']
89
+ size = hash['size']
90
+ fields = hash['fields']
91
+ filter = hash['filter']
92
+ except = hash['except']
101
93
 
102
- # Create object from extracted values
103
- GetSimilarUsersBody.new(type,
104
- types,
105
- user_id,
106
- user_ids,
107
- from,
108
- size,
109
- fields,
110
- filter,
111
- except,
112
- hash)
113
- end
94
+ # Create object from extracted values
95
+ GetSimilarUsersBody.new(type,
96
+ types,
97
+ user_id,
98
+ user_ids,
99
+ from,
100
+ size,
101
+ fields,
102
+ filter,
103
+ except)
114
104
  end
115
105
  end
116
106
  end
@@ -0,0 +1,33 @@
1
+ # This file was automatically generated for SuggestGrid by APIMATIC v2.0 ( https://apimatic.io ).
2
+
3
+ module SuggestGrid
4
+ class GetTypeResponse < BaseModel
5
+ # Rating type of the type that is either implicit or explicit.
6
+ # @return [String]
7
+ attr_accessor :rating
8
+
9
+ # A mapping from model property names to API property names
10
+ def self.names
11
+ if @_hash.nil?
12
+ @_hash = {}
13
+ @_hash["rating"] = "rating"
14
+ end
15
+ @_hash
16
+ end
17
+
18
+ def initialize(rating = nil)
19
+ @rating = rating
20
+ end
21
+
22
+ # Creates an instance of the object from a hash
23
+ def self.from_hash(hash)
24
+ return nil unless hash
25
+
26
+ # Extract variables from the hash
27
+ rating = hash['rating']
28
+
29
+ # Create object from extracted values
30
+ GetTypeResponse.new(rating)
31
+ end
32
+ end
33
+ end
@@ -0,0 +1,33 @@
1
+ # This file was automatically generated for SuggestGrid by APIMATIC v2.0 ( https://apimatic.io ).
2
+
3
+ module SuggestGrid
4
+ class GetTypesResponse < BaseModel
5
+ # The list of type names
6
+ # @return [List of String]
7
+ attr_accessor :types
8
+
9
+ # A mapping from model property names to API property names
10
+ def self.names
11
+ if @_hash.nil?
12
+ @_hash = {}
13
+ @_hash["types"] = "types"
14
+ end
15
+ @_hash
16
+ end
17
+
18
+ def initialize(types = nil)
19
+ @types = types
20
+ end
21
+
22
+ # Creates an instance of the object from a hash
23
+ def self.from_hash(hash)
24
+ return nil unless hash
25
+
26
+ # Extract variables from the hash
27
+ types = hash['types']
28
+
29
+ # Create object from extracted values
30
+ GetTypesResponse.new(types)
31
+ end
32
+ end
33
+ end
@@ -0,0 +1,56 @@
1
+ # This file was automatically generated for SuggestGrid by APIMATIC v2.0 ( https://apimatic.io ).
2
+
3
+ module SuggestGrid
4
+ class ItemsResponse < BaseModel
5
+ # The number of items in the response.
6
+ # @return [Long]
7
+ attr_accessor :count
8
+
9
+ # The total number of items available.
10
+ # @return [Long]
11
+ attr_accessor :total_count
12
+
13
+ # The total number of items available.
14
+ # @return [List of Metadata]
15
+ attr_accessor :items
16
+
17
+ # A mapping from model property names to API property names
18
+ def self.names
19
+ if @_hash.nil?
20
+ @_hash = {}
21
+ @_hash["count"] = "count"
22
+ @_hash["total_count"] = "total_count"
23
+ @_hash["items"] = "items"
24
+ end
25
+ @_hash
26
+ end
27
+
28
+ def initialize(count = nil,
29
+ total_count = nil,
30
+ items = nil)
31
+ @count = count
32
+ @total_count = total_count
33
+ @items = items
34
+ end
35
+
36
+ # Creates an instance of the object from a hash
37
+ def self.from_hash(hash)
38
+ return nil unless hash
39
+
40
+ # Extract variables from the hash
41
+ count = hash['count']
42
+ total_count = hash['total_count']
43
+ # Parameter is an array, so we need to iterate through it
44
+ items = nil
45
+ if hash['items'] != nil
46
+ items = Array.new
47
+ hash['items'].each{|structure| items << (Metadata.from_hash(structure) if structure)}
48
+ end
49
+
50
+ # Create object from extracted values
51
+ ItemsResponse.new(count,
52
+ total_count,
53
+ items)
54
+ end
55
+ end
56
+ end
@@ -0,0 +1,33 @@
1
+ # This file was automatically generated for SuggestGrid by APIMATIC v2.0 ( https://apimatic.io ).
2
+
3
+ module SuggestGrid
4
+ class MessageResponse < BaseModel
5
+ # Message of the response.
6
+ # @return [String]
7
+ attr_accessor :message
8
+
9
+ # A mapping from model property names to API property names
10
+ def self.names
11
+ if @_hash.nil?
12
+ @_hash = {}
13
+ @_hash["message"] = "message"
14
+ end
15
+ @_hash
16
+ end
17
+
18
+ def initialize(message = nil)
19
+ @message = message
20
+ end
21
+
22
+ # Creates an instance of the object from a hash
23
+ def self.from_hash(hash)
24
+ return nil unless hash
25
+
26
+ # Extract variables from the hash
27
+ message = hash['message']
28
+
29
+ # Create object from extracted values
30
+ MessageResponse.new(message)
31
+ end
32
+ end
33
+ end
@@ -0,0 +1,49 @@
1
+ # This file was automatically generated for SuggestGrid by APIMATIC v2.0 ( https://apimatic.io ).
2
+
3
+ module SuggestGrid
4
+ class Metadata < BaseModel
5
+ # The id of the metadata of a user or an item.
6
+ # @return [String]
7
+ attr_accessor :id
8
+
9
+ # A mapping from model property names to API property names
10
+ def self.names
11
+ if @_hash.nil?
12
+ @_hash = {}
13
+ @_hash["id"] = "id"
14
+ end
15
+ @_hash
16
+ end
17
+
18
+ def initialize(hash)
19
+ if !hash['id']
20
+ hash['id'] = nil
21
+ end
22
+ hash.each { |name, value|
23
+ instance_variable_set("@#{name}", value)
24
+ }
25
+ end
26
+
27
+ # Creates an instance of the object from a hash
28
+ def self.from_hash(hash)
29
+ Metadata.new(hash)
30
+ end
31
+
32
+ # Use to allow additional model properties
33
+ def method_missing(method_sym, *arguments, &block)
34
+ method = method_sym.to_s
35
+ if method.end_with? '='
36
+ instance_variable_set("@%s" % [method.chomp('=')], arguments.first)
37
+ elsif instance_variable_defined?("@#{method}") && arguments.empty?
38
+ instance_variable_get("@#{method}")
39
+ else
40
+ super
41
+ end
42
+ end
43
+
44
+ # Override for additional model properties
45
+ def respond_to?(method_sym, include_private=false)
46
+ instance_variable_defined?("@#{method_sym}") ? true : super
47
+ end
48
+ end
49
+ end