suggestgrid 0.3.0 → 0.5.0.rc3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (41) hide show
  1. checksums.yaml +4 -4
  2. data/lib/suggestgrid/api_helper.rb +146 -54
  3. data/lib/suggestgrid/configuration.rb +5 -2
  4. data/lib/suggestgrid/controllers/action_controller.rb +178 -79
  5. data/lib/suggestgrid/controllers/base_controller.rb +18 -15
  6. data/lib/suggestgrid/controllers/metadata_controller.rb +313 -171
  7. data/lib/suggestgrid/controllers/recommendation_controller.rb +75 -35
  8. data/lib/suggestgrid/controllers/similarity_controller.rb +75 -35
  9. data/lib/suggestgrid/controllers/type_controller.rb +131 -74
  10. data/lib/suggestgrid/exceptions/api_exception.rb +4 -2
  11. data/lib/suggestgrid/exceptions/{detailed_error_response_error_exception.rb → detailed_error_response.rb} +9 -9
  12. data/lib/suggestgrid/exceptions/{error_response_error_exception.rb → error_response.rb} +9 -9
  13. data/lib/suggestgrid/exceptions/{limit_exceeded_error_response_error_exception.rb → limit_exceeded_error_response.rb} +9 -9
  14. data/lib/suggestgrid/http/auth/basic_auth.rb +8 -5
  15. data/lib/suggestgrid/http/faraday_client.rb +19 -7
  16. data/lib/suggestgrid/http/http_call_back.rb +11 -6
  17. data/lib/suggestgrid/http/http_client.rb +50 -32
  18. data/lib/suggestgrid/http/http_context.rb +5 -2
  19. data/lib/suggestgrid/http/http_method_enum.rb +6 -2
  20. data/lib/suggestgrid/http/http_request.rb +7 -3
  21. data/lib/suggestgrid/http/http_response.rb +3 -1
  22. data/lib/suggestgrid/models/action.rb +15 -14
  23. data/lib/suggestgrid/models/actions_response.rb +16 -14
  24. data/lib/suggestgrid/models/base_model.rb +11 -9
  25. data/lib/suggestgrid/models/bulk_post_error.rb +11 -11
  26. data/lib/suggestgrid/models/bulk_post_response.rb +16 -13
  27. data/lib/suggestgrid/models/get_recommended_items_body.rb +32 -25
  28. data/lib/suggestgrid/models/get_recommended_users_body.rb +32 -25
  29. data/lib/suggestgrid/models/get_similar_items_body.rb +33 -24
  30. data/lib/suggestgrid/models/get_similar_users_body.rb +30 -23
  31. data/lib/suggestgrid/models/get_type_response.rb +9 -9
  32. data/lib/suggestgrid/models/get_types_response.rb +9 -9
  33. data/lib/suggestgrid/models/items_response.rb +16 -14
  34. data/lib/suggestgrid/models/message_response.rb +9 -9
  35. data/lib/suggestgrid/models/metadata.rb +9 -8
  36. data/lib/suggestgrid/models/type_request_body.rb +11 -10
  37. data/lib/suggestgrid/models/users_response.rb +16 -14
  38. data/lib/suggestgrid/suggestgrid_client.rb +16 -14
  39. data/lib/suggestgrid.rb +5 -4
  40. data/spec/swagger.yaml +3 -3
  41. metadata +8 -8
@@ -1,6 +1,9 @@
1
- # This file was automatically generated for SuggestGrid by APIMATIC v2.0 ( https://apimatic.io ).
1
+ # This file was automatically generated for SuggestGrid by APIMATIC v2.0
2
+ # ( https://apimatic.io ).
2
3
 
3
4
  module SuggestGrid
5
+ # Bulk error response. Returned on all bulk post requests regardless of the
6
+ # number of erroneous or successful posts.
4
7
  class BulkPostResponse < BaseModel
5
8
  # Message of the response.
6
9
  # @return [String]
@@ -10,13 +13,11 @@ module SuggestGrid
10
13
  # @return [List of BulkPostError]
11
14
  attr_accessor :errors
12
15
 
13
- # A mapping from model property names to API property names
16
+ # A mapping from model property names to API property names.
14
17
  def self.names
15
- if @_hash.nil?
16
- @_hash = {}
17
- @_hash["message"] = "message"
18
- @_hash["errors"] = "errors"
19
- end
18
+ @_hash = {} if @_hash.nil?
19
+ @_hash['message'] = 'message'
20
+ @_hash['errors'] = 'errors'
20
21
  @_hash
21
22
  end
22
23
 
@@ -26,20 +27,22 @@ module SuggestGrid
26
27
  @errors = errors
27
28
  end
28
29
 
29
- # Creates an instance of the object from a hash
30
+ # Creates an instance of the object from a hash.
30
31
  def self.from_hash(hash)
31
32
  return nil unless hash
32
33
 
33
- # Extract variables from the hash
34
+ # Extract variables from the hash.
34
35
  message = hash['message']
35
36
  # Parameter is an array, so we need to iterate through it
36
37
  errors = nil
37
- if hash['errors'] != nil
38
- errors = Array.new
39
- hash['errors'].each{|structure| errors << (BulkPostError.from_hash(structure) if structure)}
38
+ unless hash['errors'].nil?
39
+ errors = []
40
+ hash['errors'].each do |structure|
41
+ errors << (BulkPostError.from_hash(structure) if structure)
42
+ end
40
43
  end
41
44
 
42
- # Create object from extracted values
45
+ # Create object from extracted values.
43
46
  BulkPostResponse.new(message,
44
47
  errors)
45
48
  end
@@ -1,12 +1,16 @@
1
- # This file was automatically generated for SuggestGrid by APIMATIC v2.0 ( https://apimatic.io ).
1
+ # This file was automatically generated for SuggestGrid by APIMATIC v2.0
2
+ # ( https://apimatic.io ).
2
3
 
3
4
  module SuggestGrid
5
+ # Query for recommended items.
4
6
  class GetRecommendedItemsBody < BaseModel
5
- # The type of the query. Recommendations will be calculated based on actions of this type.
7
+ # The type of the query. Recommendations will be calculated based on actions
8
+ # of this type.
6
9
  # @return [String]
7
10
  attr_accessor :type
8
11
 
9
- # The types of the query. Exactly one of type or types parameters must be provided.
12
+ # The types of the query. Exactly one of type or types parameters must be
13
+ # provided.
10
14
  # @return [List of String]
11
15
  attr_accessor :types
12
16
 
@@ -14,15 +18,18 @@ module SuggestGrid
14
18
  # @return [String]
15
19
  attr_accessor :user_id
16
20
 
17
- # The user ids of the query. Exactly one of user id or user ids parameters must be provided.
21
+ # The user ids of the query. Exactly one of user id or user ids parameters
22
+ # must be provided.
18
23
  # @return [List of String]
19
24
  attr_accessor :user_ids
20
25
 
21
- # The number of most recommended items to be skipped from the response. Defaults to 0.
26
+ # The number of most recommended items to be skipped from the response.
27
+ # Defaults to 0.
22
28
  # @return [Integer]
23
29
  attr_accessor :from
24
30
 
25
- # The number of items requested. Defaults to 10. Must be between 1 and 10,000 inclusive.
31
+ # The number of items requested. Defaults to 10. Must be between 1 and
32
+ # 10,000 inclusive.
26
33
  # @return [Integer]
27
34
  attr_accessor :size
28
35
 
@@ -40,7 +47,9 @@ module SuggestGrid
40
47
  attr_accessor :fields
41
48
 
42
49
  # Contraints on the returned users or items.
43
- # Filter structure is defined in [the filter parameter documentation](http://www.suggestgrid.com/docs/advanced-features#filters-parameter).
50
+ # Filter structure is defined in [the filter parameter
51
+ # documentation](http://www.suggestgrid.com/docs/advanced-features#filters-p
52
+ # arameter).
44
53
  # @return [Array<String, Boolean>]
45
54
  attr_accessor :filter
46
55
 
@@ -48,22 +57,20 @@ module SuggestGrid
48
57
  # @return [List of String]
49
58
  attr_accessor :except
50
59
 
51
- # A mapping from model property names to API property names
60
+ # A mapping from model property names to API property names.
52
61
  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"
66
- end
62
+ @_hash = {} if @_hash.nil?
63
+ @_hash['type'] = 'type'
64
+ @_hash['types'] = 'types'
65
+ @_hash['user_id'] = 'user_id'
66
+ @_hash['user_ids'] = 'user_ids'
67
+ @_hash['from'] = 'from'
68
+ @_hash['size'] = 'size'
69
+ @_hash['similar_item_id'] = 'similar_item_id'
70
+ @_hash['similar_item_ids'] = 'similar_item_ids'
71
+ @_hash['fields'] = 'fields'
72
+ @_hash['filter'] = 'filter'
73
+ @_hash['except'] = 'except'
67
74
  @_hash
68
75
  end
69
76
 
@@ -91,11 +98,11 @@ module SuggestGrid
91
98
  @except = except
92
99
  end
93
100
 
94
- # Creates an instance of the object from a hash
101
+ # Creates an instance of the object from a hash.
95
102
  def self.from_hash(hash)
96
103
  return nil unless hash
97
104
 
98
- # Extract variables from the hash
105
+ # Extract variables from the hash.
99
106
  type = hash['type']
100
107
  types = hash['types']
101
108
  user_id = hash['user_id']
@@ -108,7 +115,7 @@ module SuggestGrid
108
115
  filter = hash['filter']
109
116
  except = hash['except']
110
117
 
111
- # Create object from extracted values
118
+ # Create object from extracted values.
112
119
  GetRecommendedItemsBody.new(type,
113
120
  types,
114
121
  user_id,
@@ -1,12 +1,16 @@
1
- # This file was automatically generated for SuggestGrid by APIMATIC v2.0 ( https://apimatic.io ).
1
+ # This file was automatically generated for SuggestGrid by APIMATIC v2.0
2
+ # ( https://apimatic.io ).
2
3
 
3
4
  module SuggestGrid
5
+ # Query for recommended users.
4
6
  class GetRecommendedUsersBody < BaseModel
5
- # The type of the query. Recommendations will be calculated based on actions of this type.
7
+ # The type of the query. Recommendations will be calculated based on actions
8
+ # of this type.
6
9
  # @return [String]
7
10
  attr_accessor :type
8
11
 
9
- # The types of the query. Exactly one of type or types parameters must be provided.
12
+ # The types of the query. Exactly one of type or types parameters must be
13
+ # provided.
10
14
  # @return [List of String]
11
15
  attr_accessor :types
12
16
 
@@ -14,15 +18,18 @@ module SuggestGrid
14
18
  # @return [String]
15
19
  attr_accessor :item_id
16
20
 
17
- # The item ids of the query. Exactly one of item id or item ids parameters must be provided.
21
+ # The item ids of the query. Exactly one of item id or item ids parameters
22
+ # must be provided.
18
23
  # @return [List of String]
19
24
  attr_accessor :item_ids
20
25
 
21
- # The number of most recommended items to be skipped from the response. Defaults to 0.
26
+ # The number of most recommended items to be skipped from the response.
27
+ # Defaults to 0.
22
28
  # @return [Integer]
23
29
  attr_accessor :from
24
30
 
25
- # The number of users requested. Defaults to 10. Must be between 1 and 10,000 inclusive.
31
+ # The number of users requested. Defaults to 10. Must be between 1 and
32
+ # 10,000 inclusive.
26
33
  # @return [Integer]
27
34
  attr_accessor :size
28
35
 
@@ -40,7 +47,9 @@ module SuggestGrid
40
47
  attr_accessor :fields
41
48
 
42
49
  # Contraints on the returned users or items.
43
- # Filter structure is defined in [the filter parameter documentation](http://www.suggestgrid.com/docs/advanced-features#filters-parameter).
50
+ # Filter structure is defined in [the filter parameter
51
+ # documentation](http://www.suggestgrid.com/docs/advanced-features#filters-p
52
+ # arameter).
44
53
  # @return [Array<String, Boolean>]
45
54
  attr_accessor :filter
46
55
 
@@ -48,22 +57,20 @@ module SuggestGrid
48
57
  # @return [List of String]
49
58
  attr_accessor :except
50
59
 
51
- # A mapping from model property names to API property names
60
+ # A mapping from model property names to API property names.
52
61
  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"
66
- end
62
+ @_hash = {} if @_hash.nil?
63
+ @_hash['type'] = 'type'
64
+ @_hash['types'] = 'types'
65
+ @_hash['item_id'] = 'item_id'
66
+ @_hash['item_ids'] = 'item_ids'
67
+ @_hash['from'] = 'from'
68
+ @_hash['size'] = 'size'
69
+ @_hash['similar_user_id'] = 'similar_user_id'
70
+ @_hash['similar_user_ids'] = 'similar_user_ids'
71
+ @_hash['fields'] = 'fields'
72
+ @_hash['filter'] = 'filter'
73
+ @_hash['except'] = 'except'
67
74
  @_hash
68
75
  end
69
76
 
@@ -91,11 +98,11 @@ module SuggestGrid
91
98
  @except = except
92
99
  end
93
100
 
94
- # Creates an instance of the object from a hash
101
+ # Creates an instance of the object from a hash.
95
102
  def self.from_hash(hash)
96
103
  return nil unless hash
97
104
 
98
- # Extract variables from the hash
105
+ # Extract variables from the hash.
99
106
  type = hash['type']
100
107
  types = hash['types']
101
108
  item_id = hash['item_id']
@@ -108,7 +115,7 @@ module SuggestGrid
108
115
  filter = hash['filter']
109
116
  except = hash['except']
110
117
 
111
- # Create object from extracted values
118
+ # Create object from extracted values.
112
119
  GetRecommendedUsersBody.new(type,
113
120
  types,
114
121
  item_id,
@@ -1,28 +1,37 @@
1
- # This file was automatically generated for SuggestGrid by APIMATIC v2.0 ( https://apimatic.io ).
1
+ # This file was automatically generated for SuggestGrid by APIMATIC v2.0
2
+ # ( https://apimatic.io ).
2
3
 
3
4
  module SuggestGrid
5
+ # Query for similar items.
4
6
  class GetSimilarItemsBody < BaseModel
5
- # The type of the query. Similarities will be calculated based on actions of this type.
7
+ # The type of the query. Similarities will be calculated based on actions of
8
+ # this type.
6
9
  # @return [String]
7
10
  attr_accessor :type
8
11
 
9
- # The types of the query. Exactly one of type or types parameters must be provided.
12
+ # The types of the query. Exactly one of type or types parameters must be
13
+ # provided.
10
14
  # @return [List of String]
11
15
  attr_accessor :types
12
16
 
13
- # The item id of the query. Get similar items to given item id. Either item id or item ids must be provided.
17
+ # The item id of the query. Get similar items to given item id. Either item
18
+ # id or item ids must be provided.
14
19
  # @return [String]
15
20
  attr_accessor :item_id
16
21
 
17
- # The item ids of the query. Exactly one of item id or item ids parameters must be provided. Get similar items to given item ids. Either item id or item ids must be provided.
22
+ # The item ids of the query. Exactly one of item id or item ids parameters
23
+ # must be provided. Get similar items to given item ids. Either item id or
24
+ # item ids must be provided.
18
25
  # @return [List of String]
19
26
  attr_accessor :item_ids
20
27
 
21
- # The number of most similar items to be skipped from the response. Defaults to 0.
28
+ # The number of most similar items to be skipped from the response. Defaults
29
+ # to 0.
22
30
  # @return [Integer]
23
31
  attr_accessor :from
24
32
 
25
- # The number of items requested. Defaults to 10. Must be between 1 and 10,000 inclusive.
33
+ # The number of items requested. Defaults to 10. Must be between 1 and
34
+ # 10,000 inclusive.
26
35
  # @return [Integer]
27
36
  attr_accessor :size
28
37
 
@@ -31,7 +40,9 @@ module SuggestGrid
31
40
  attr_accessor :fields
32
41
 
33
42
  # Contraints on the returned users or items.
34
- # Filter structure is defined in [the filter parameter documentation](http://www.suggestgrid.com/docs/advanced-features#filters-parameter).
43
+ # Filter structure is defined in [the filter parameter
44
+ # documentation](http://www.suggestgrid.com/docs/advanced-features#filters-p
45
+ # arameter).
35
46
  # @return [Array<String, Boolean>]
36
47
  attr_accessor :filter
37
48
 
@@ -39,20 +50,18 @@ module SuggestGrid
39
50
  # @return [List of String]
40
51
  attr_accessor :except
41
52
 
42
- # A mapping from model property names to API property names
53
+ # A mapping from model property names to API property names.
43
54
  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"
55
- end
55
+ @_hash = {} if @_hash.nil?
56
+ @_hash['type'] = 'type'
57
+ @_hash['types'] = 'types'
58
+ @_hash['item_id'] = 'item_id'
59
+ @_hash['item_ids'] = 'item_ids'
60
+ @_hash['from'] = 'from'
61
+ @_hash['size'] = 'size'
62
+ @_hash['fields'] = 'fields'
63
+ @_hash['filter'] = 'filter'
64
+ @_hash['except'] = 'except'
56
65
  @_hash
57
66
  end
58
67
 
@@ -76,11 +85,11 @@ module SuggestGrid
76
85
  @except = except
77
86
  end
78
87
 
79
- # Creates an instance of the object from a hash
88
+ # Creates an instance of the object from a hash.
80
89
  def self.from_hash(hash)
81
90
  return nil unless hash
82
91
 
83
- # Extract variables from the hash
92
+ # Extract variables from the hash.
84
93
  type = hash['type']
85
94
  types = hash['types']
86
95
  item_id = hash['item_id']
@@ -91,7 +100,7 @@ module SuggestGrid
91
100
  filter = hash['filter']
92
101
  except = hash['except']
93
102
 
94
- # Create object from extracted values
103
+ # Create object from extracted values.
95
104
  GetSimilarItemsBody.new(type,
96
105
  types,
97
106
  item_id,
@@ -1,12 +1,16 @@
1
- # This file was automatically generated for SuggestGrid by APIMATIC v2.0 ( https://apimatic.io ).
1
+ # This file was automatically generated for SuggestGrid by APIMATIC v2.0
2
+ # ( https://apimatic.io ).
2
3
 
3
4
  module SuggestGrid
5
+ # Query for similar users.
4
6
  class GetSimilarUsersBody < BaseModel
5
- # The type of the query. Similarities will be calculated based on actions of this type.
7
+ # The type of the query. Similarities will be calculated based on actions of
8
+ # this type.
6
9
  # @return [String]
7
10
  attr_accessor :type
8
11
 
9
- # The types of the query. Exactly one of type or types parameters must be provided.
12
+ # The types of the query. Exactly one of type or types parameters must be
13
+ # provided.
10
14
  # @return [List of String]
11
15
  attr_accessor :types
12
16
 
@@ -14,15 +18,18 @@ module SuggestGrid
14
18
  # @return [String]
15
19
  attr_accessor :user_id
16
20
 
17
- # The user ids of the query. Exactly one of user id or user ids parameters must be provided.
21
+ # The user ids of the query. Exactly one of user id or user ids parameters
22
+ # must be provided.
18
23
  # @return [List of String]
19
24
  attr_accessor :user_ids
20
25
 
21
- # The number of most similar users to be skipped from the response. Defaults to 0.
26
+ # The number of most similar users to be skipped from the response. Defaults
27
+ # to 0.
22
28
  # @return [Integer]
23
29
  attr_accessor :from
24
30
 
25
- # The number of users requested. Defaults to 10. Must be between 1 and 10,000 inclusive.
31
+ # The number of users requested. Defaults to 10. Must be between 1 and
32
+ # 10,000 inclusive.
26
33
  # @return [Integer]
27
34
  attr_accessor :size
28
35
 
@@ -31,7 +38,9 @@ module SuggestGrid
31
38
  attr_accessor :fields
32
39
 
33
40
  # Contraints on the returned users or items.
34
- # Filter structure is defined in [the filter parameter documentation](http://www.suggestgrid.com/docs/advanced-features#filters-parameter).
41
+ # Filter structure is defined in [the filter parameter
42
+ # documentation](http://www.suggestgrid.com/docs/advanced-features#filters-p
43
+ # arameter).
35
44
  # @return [Array<String, Boolean>]
36
45
  attr_accessor :filter
37
46
 
@@ -39,20 +48,18 @@ module SuggestGrid
39
48
  # @return [List of String]
40
49
  attr_accessor :except
41
50
 
42
- # A mapping from model property names to API property names
51
+ # A mapping from model property names to API property names.
43
52
  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"
55
- end
53
+ @_hash = {} if @_hash.nil?
54
+ @_hash['type'] = 'type'
55
+ @_hash['types'] = 'types'
56
+ @_hash['user_id'] = 'user_id'
57
+ @_hash['user_ids'] = 'user_ids'
58
+ @_hash['from'] = 'from'
59
+ @_hash['size'] = 'size'
60
+ @_hash['fields'] = 'fields'
61
+ @_hash['filter'] = 'filter'
62
+ @_hash['except'] = 'except'
56
63
  @_hash
57
64
  end
58
65
 
@@ -76,11 +83,11 @@ module SuggestGrid
76
83
  @except = except
77
84
  end
78
85
 
79
- # Creates an instance of the object from a hash
86
+ # Creates an instance of the object from a hash.
80
87
  def self.from_hash(hash)
81
88
  return nil unless hash
82
89
 
83
- # Extract variables from the hash
90
+ # Extract variables from the hash.
84
91
  type = hash['type']
85
92
  types = hash['types']
86
93
  user_id = hash['user_id']
@@ -91,7 +98,7 @@ module SuggestGrid
91
98
  filter = hash['filter']
92
99
  except = hash['except']
93
100
 
94
- # Create object from extracted values
101
+ # Create object from extracted values.
95
102
  GetSimilarUsersBody.new(type,
96
103
  types,
97
104
  user_id,
@@ -1,17 +1,17 @@
1
- # This file was automatically generated for SuggestGrid by APIMATIC v2.0 ( https://apimatic.io ).
1
+ # This file was automatically generated for SuggestGrid by APIMATIC v2.0
2
+ # ( https://apimatic.io ).
2
3
 
3
4
  module SuggestGrid
5
+ # Get type details response.
4
6
  class GetTypeResponse < BaseModel
5
7
  # Rating type of the type that is either implicit or explicit.
6
8
  # @return [String]
7
9
  attr_accessor :rating
8
10
 
9
- # A mapping from model property names to API property names
11
+ # A mapping from model property names to API property names.
10
12
  def self.names
11
- if @_hash.nil?
12
- @_hash = {}
13
- @_hash["rating"] = "rating"
14
- end
13
+ @_hash = {} if @_hash.nil?
14
+ @_hash['rating'] = 'rating'
15
15
  @_hash
16
16
  end
17
17
 
@@ -19,14 +19,14 @@ module SuggestGrid
19
19
  @rating = rating
20
20
  end
21
21
 
22
- # Creates an instance of the object from a hash
22
+ # Creates an instance of the object from a hash.
23
23
  def self.from_hash(hash)
24
24
  return nil unless hash
25
25
 
26
- # Extract variables from the hash
26
+ # Extract variables from the hash.
27
27
  rating = hash['rating']
28
28
 
29
- # Create object from extracted values
29
+ # Create object from extracted values.
30
30
  GetTypeResponse.new(rating)
31
31
  end
32
32
  end
@@ -1,17 +1,17 @@
1
- # This file was automatically generated for SuggestGrid by APIMATIC v2.0 ( https://apimatic.io ).
1
+ # This file was automatically generated for SuggestGrid by APIMATIC v2.0
2
+ # ( https://apimatic.io ).
2
3
 
3
4
  module SuggestGrid
5
+ # Type names response.
4
6
  class GetTypesResponse < BaseModel
5
7
  # The list of type names
6
8
  # @return [List of String]
7
9
  attr_accessor :types
8
10
 
9
- # A mapping from model property names to API property names
11
+ # A mapping from model property names to API property names.
10
12
  def self.names
11
- if @_hash.nil?
12
- @_hash = {}
13
- @_hash["types"] = "types"
14
- end
13
+ @_hash = {} if @_hash.nil?
14
+ @_hash['types'] = 'types'
15
15
  @_hash
16
16
  end
17
17
 
@@ -19,14 +19,14 @@ module SuggestGrid
19
19
  @types = types
20
20
  end
21
21
 
22
- # Creates an instance of the object from a hash
22
+ # Creates an instance of the object from a hash.
23
23
  def self.from_hash(hash)
24
24
  return nil unless hash
25
25
 
26
- # Extract variables from the hash
26
+ # Extract variables from the hash.
27
27
  types = hash['types']
28
28
 
29
- # Create object from extracted values
29
+ # Create object from extracted values.
30
30
  GetTypesResponse.new(types)
31
31
  end
32
32
  end
@@ -1,6 +1,8 @@
1
- # This file was automatically generated for SuggestGrid by APIMATIC v2.0 ( https://apimatic.io ).
1
+ # This file was automatically generated for SuggestGrid by APIMATIC v2.0
2
+ # ( https://apimatic.io ).
2
3
 
3
4
  module SuggestGrid
5
+ # Get items response.
4
6
  class ItemsResponse < BaseModel
5
7
  # The number of items in the response.
6
8
  # @return [Long]
@@ -14,14 +16,12 @@ module SuggestGrid
14
16
  # @return [List of Metadata]
15
17
  attr_accessor :items
16
18
 
17
- # A mapping from model property names to API property names
19
+ # A mapping from model property names to API property names.
18
20
  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
21
+ @_hash = {} if @_hash.nil?
22
+ @_hash['count'] = 'count'
23
+ @_hash['total_count'] = 'total_count'
24
+ @_hash['items'] = 'items'
25
25
  @_hash
26
26
  end
27
27
 
@@ -33,21 +33,23 @@ module SuggestGrid
33
33
  @items = items
34
34
  end
35
35
 
36
- # Creates an instance of the object from a hash
36
+ # Creates an instance of the object from a hash.
37
37
  def self.from_hash(hash)
38
38
  return nil unless hash
39
39
 
40
- # Extract variables from the hash
40
+ # Extract variables from the hash.
41
41
  count = hash['count']
42
42
  total_count = hash['total_count']
43
43
  # Parameter is an array, so we need to iterate through it
44
44
  items = nil
45
- if hash['items'] != nil
46
- items = Array.new
47
- hash['items'].each{|structure| items << (Metadata.from_hash(structure) if structure)}
45
+ unless hash['items'].nil?
46
+ items = []
47
+ hash['items'].each do |structure|
48
+ items << (Metadata.from_hash(structure) if structure)
49
+ end
48
50
  end
49
51
 
50
- # Create object from extracted values
52
+ # Create object from extracted values.
51
53
  ItemsResponse.new(count,
52
54
  total_count,
53
55
  items)