suggestgrid 0.1.27 → 0.1.30

Sign up to get free protection for your applications and to get access to all the features.
Files changed (36) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +1 -1
  3. data/lib/suggest_grid/api_helper.rb +6 -0
  4. data/lib/suggest_grid/configuration.rb +1 -0
  5. data/lib/suggest_grid/controllers/action_controller.rb +94 -142
  6. data/lib/suggest_grid/controllers/base_controller.rb +3 -2
  7. data/lib/suggest_grid/controllers/metadata_controller.rb +182 -330
  8. data/lib/suggest_grid/controllers/recommendation_controller.rb +18 -42
  9. data/lib/suggest_grid/controllers/similarity_controller.rb +18 -42
  10. data/lib/suggest_grid/controllers/type_controller.rb +76 -140
  11. data/lib/suggest_grid/exceptions/delete_error_response_exception.rb +7 -7
  12. data/lib/suggest_grid/exceptions/detailed_error_response_exception.rb +1 -1
  13. data/lib/suggest_grid/exceptions/error_response_exception.rb +1 -1
  14. data/lib/suggest_grid/exceptions/limit_exceeded_error_response_exception.rb +3 -3
  15. data/lib/suggest_grid/http/faraday_client.rb +3 -1
  16. data/lib/suggest_grid/http/http_client.rb +4 -2
  17. data/lib/suggest_grid/models/action.rb +19 -2
  18. data/lib/suggest_grid/models/actions_response.rb +10 -2
  19. data/lib/suggest_grid/models/base_model.rb +17 -0
  20. data/lib/suggest_grid/models/bulk_post_error.rb +10 -2
  21. data/lib/suggest_grid/models/bulk_post_response.rb +10 -2
  22. data/lib/suggest_grid/models/delete_success_response.rb +16 -8
  23. data/lib/suggest_grid/models/get_recommended_items_body.rb +16 -8
  24. data/lib/suggest_grid/models/get_recommended_users_body.rb +16 -8
  25. data/lib/suggest_grid/models/get_similar_items_body.rb +15 -7
  26. data/lib/suggest_grid/models/get_similar_users_body.rb +15 -7
  27. data/lib/suggest_grid/models/get_type_response.rb +10 -2
  28. data/lib/suggest_grid/models/get_types_response.rb +8 -9
  29. data/lib/suggest_grid/models/items_response.rb +10 -2
  30. data/lib/suggest_grid/models/message_response.rb +10 -2
  31. data/lib/suggest_grid/models/metadata.rb +19 -10
  32. data/lib/suggest_grid/models/type_request_body.rb +11 -5
  33. data/lib/suggest_grid/models/users_response.rb +10 -2
  34. data/lib/suggest_grid.rb +2 -0
  35. data/spec/swagger.yaml +122 -194
  36. metadata +21 -7
@@ -2,23 +2,25 @@
2
2
 
3
3
  module SuggestGrid
4
4
  class Metadata < BaseModel
5
- # The id of the user or the item that the metadata is associated with.
6
- # Id parameter is necessary for all metadata.
7
- # attr_accessor :id
5
+ # The id of the metadata of a user or an item.
6
+ # @return [String]
7
+ attr_accessor :id
8
8
 
9
9
  # A mapping from model property names to API property names
10
10
  def self.names
11
11
  if @hash.nil?
12
- @hash = self.instance_variables.inject({}) { |h, (k, v)| h[k] = k; h }
12
+ @hash = {}
13
+ @hash["id"] = "id"
13
14
  end
14
15
  @hash
15
16
  end
16
17
 
17
- def initialize(props = {})
18
- props.each do |name, value|
19
- instance_variable_set("@#{name}", value)
20
- singleton_class.class_eval { attr_accessor name }
21
- end
18
+ def initialize(id = nil,
19
+ additional_properties = {})
20
+ @id = id
21
+
22
+ # Add additional model properties to the instance
23
+ additional_properties.each {|name, value| instance_variable_set("@#{name}", value)}
22
24
  end
23
25
 
24
26
  # Creates an instance of the object from a hash
@@ -26,8 +28,15 @@ module SuggestGrid
26
28
  if hash == nil
27
29
  nil
28
30
  else
31
+ # Extract variables from the hash
32
+ id = hash["id"]
33
+
34
+ # Clean out expected properties from Hash
35
+ names.values.each {|k| hash.delete(k)}
36
+
29
37
  # Create object from extracted values
30
- Metadata.new(hash)
38
+ Metadata.new(id,
39
+ hash)
31
40
  end
32
41
  end
33
42
  end
@@ -2,9 +2,7 @@
2
2
 
3
3
  module SuggestGrid
4
4
  class TypeRequestBody < BaseModel
5
- # The rating type of the type to be created.
6
- # Could be "explicit" or "implicit"
7
- # The default is "implicit".
5
+ # The rating type of the type. Could be "explicit" or "implicit", where "implicit" is the default.
8
6
  # @return [String]
9
7
  attr_accessor :rating
10
8
 
@@ -17,8 +15,12 @@ module SuggestGrid
17
15
  @hash
18
16
  end
19
17
 
20
- def initialize(rating = nil)
18
+ def initialize(rating = nil,
19
+ additional_properties = {})
21
20
  @rating = rating
21
+
22
+ # Add additional model properties to the instance
23
+ additional_properties.each {|name, value| instance_variable_set("@#{name}", value)}
22
24
  end
23
25
 
24
26
  # Creates an instance of the object from a hash
@@ -29,8 +31,12 @@ module SuggestGrid
29
31
  # Extract variables from the hash
30
32
  rating = hash["rating"]
31
33
 
34
+ # Clean out expected properties from Hash
35
+ names.values.each {|k| hash.delete(k)}
36
+
32
37
  # Create object from extracted values
33
- TypeRequestBody.new(rating)
38
+ TypeRequestBody.new(rating,
39
+ hash)
34
40
  end
35
41
  end
36
42
  end
@@ -27,10 +27,14 @@ module SuggestGrid
27
27
 
28
28
  def initialize(count = nil,
29
29
  total_count = nil,
30
- users = nil)
30
+ users = nil,
31
+ additional_properties = {})
31
32
  @count = count
32
33
  @total_count = total_count
33
34
  @users = users
35
+
36
+ # Add additional model properties to the instance
37
+ additional_properties.each {|name, value| instance_variable_set("@#{name}", value)}
34
38
  end
35
39
 
36
40
  # Creates an instance of the object from a hash
@@ -48,10 +52,14 @@ module SuggestGrid
48
52
  hash["users"].each{|structure| users << (Metadata.from_hash(structure) if structure)}
49
53
  end
50
54
 
55
+ # Clean out expected properties from Hash
56
+ names.values.each {|k| hash.delete(k)}
57
+
51
58
  # Create object from extracted values
52
59
  UsersResponse.new(count,
53
60
  total_count,
54
- users)
61
+ users,
62
+ hash)
55
63
  end
56
64
  end
57
65
  end
data/lib/suggest_grid.rb CHANGED
@@ -1,7 +1,9 @@
1
1
  # This file was automatically generated for SuggestGrid by APIMATIC v2.0 ( https://apimatic.io ).
2
+ require 'date'
2
3
  require 'json'
3
4
  require 'faraday'
4
5
  require 'certifi'
6
+ require 'logging'
5
7
 
6
8
  require_relative 'suggest_grid/api_helper.rb'
7
9
  require_relative 'suggest_grid/suggest_grid_client.rb'