moonlogs-ruby 1.18.5 → 1.18.6

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 (64) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +24 -5
  3. data/docs/DefaultApi.md +48 -0
  4. data/docs/IncidentResponse.md +12 -0
  5. data/docs/IncidentSearchRequest.md +7 -0
  6. data/docs/InlineResponse20020.md +11 -0
  7. data/lib/moonlogs-ruby/api/default_api.rb +51 -1
  8. data/lib/moonlogs-ruby/api_client.rb +1 -1
  9. data/lib/moonlogs-ruby/api_error.rb +1 -1
  10. data/lib/moonlogs-ruby/configuration.rb +1 -1
  11. data/lib/moonlogs-ruby/models/action_request.rb +1 -1
  12. data/lib/moonlogs-ruby/models/action_response.rb +1 -1
  13. data/lib/moonlogs-ruby/models/api_token_request.rb +1 -1
  14. data/lib/moonlogs-ruby/models/api_token_response.rb +1 -1
  15. data/lib/moonlogs-ruby/models/condition.rb +1 -1
  16. data/lib/moonlogs-ruby/models/credentials.rb +1 -1
  17. data/lib/moonlogs-ruby/models/incident_response.rb +282 -0
  18. data/lib/moonlogs-ruby/models/incident_search_request.rb +206 -0
  19. data/lib/moonlogs-ruby/models/inline_response_200.rb +1 -1
  20. data/lib/moonlogs-ruby/models/inline_response_200_1.rb +1 -1
  21. data/lib/moonlogs-ruby/models/inline_response_200_10.rb +1 -1
  22. data/lib/moonlogs-ruby/models/inline_response_200_11.rb +1 -1
  23. data/lib/moonlogs-ruby/models/inline_response_200_12.rb +1 -1
  24. data/lib/moonlogs-ruby/models/inline_response_200_13.rb +1 -1
  25. data/lib/moonlogs-ruby/models/inline_response_200_14.rb +1 -1
  26. data/lib/moonlogs-ruby/models/inline_response_200_15.rb +1 -1
  27. data/lib/moonlogs-ruby/models/inline_response_200_16.rb +1 -1
  28. data/lib/moonlogs-ruby/models/inline_response_200_17.rb +1 -1
  29. data/lib/moonlogs-ruby/models/inline_response_200_18.rb +1 -1
  30. data/lib/moonlogs-ruby/models/inline_response_200_19.rb +1 -1
  31. data/lib/moonlogs-ruby/models/inline_response_200_2.rb +1 -1
  32. data/lib/moonlogs-ruby/models/inline_response_200_20.rb +269 -0
  33. data/lib/moonlogs-ruby/models/inline_response_200_3.rb +1 -1
  34. data/lib/moonlogs-ruby/models/inline_response_200_4.rb +1 -1
  35. data/lib/moonlogs-ruby/models/inline_response_200_5.rb +1 -1
  36. data/lib/moonlogs-ruby/models/inline_response_200_6.rb +1 -1
  37. data/lib/moonlogs-ruby/models/inline_response_200_7.rb +1 -1
  38. data/lib/moonlogs-ruby/models/inline_response_200_8.rb +1 -1
  39. data/lib/moonlogs-ruby/models/inline_response_200_9.rb +1 -1
  40. data/lib/moonlogs-ruby/models/level.rb +1 -1
  41. data/lib/moonlogs-ruby/models/meta.rb +1 -1
  42. data/lib/moonlogs-ruby/models/one_of_record_request_level.rb +1 -1
  43. data/lib/moonlogs-ruby/models/one_of_record_response_level.rb +1 -1
  44. data/lib/moonlogs-ruby/models/one_of_user_request_role.rb +1 -1
  45. data/lib/moonlogs-ruby/models/one_of_user_response_role.rb +1 -1
  46. data/lib/moonlogs-ruby/models/record_request.rb +1 -1
  47. data/lib/moonlogs-ruby/models/record_response.rb +1 -1
  48. data/lib/moonlogs-ruby/models/role.rb +1 -1
  49. data/lib/moonlogs-ruby/models/schema_field.rb +1 -1
  50. data/lib/moonlogs-ruby/models/schema_kind.rb +1 -1
  51. data/lib/moonlogs-ruby/models/schema_request.rb +1 -1
  52. data/lib/moonlogs-ruby/models/schema_response.rb +1 -1
  53. data/lib/moonlogs-ruby/models/session.rb +1 -1
  54. data/lib/moonlogs-ruby/models/tag_request.rb +1 -1
  55. data/lib/moonlogs-ruby/models/tag_response.rb +1 -1
  56. data/lib/moonlogs-ruby/models/user_request.rb +1 -1
  57. data/lib/moonlogs-ruby/models/user_response.rb +1 -1
  58. data/lib/moonlogs-ruby/version.rb +2 -2
  59. data/lib/moonlogs-ruby.rb +4 -1
  60. data/moonlogs-ruby.gemspec +1 -1
  61. data/spec/models/incident_response_spec.rb +70 -0
  62. data/spec/models/incident_search_request_spec.rb +40 -0
  63. data/spec/models/inline_response_200_20_spec.rb +64 -0
  64. metadata +13 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 027e1c33fd632bae318cb5044cdee4dc22f1cba2cd145bc26684d6fd94cb3545
4
- data.tar.gz: 42902b776e0f75d0f9c1b7fb2af256a5ae36fdc1813f81227fa3d6081a5deeb6
3
+ metadata.gz: 0e12e0a079ca33af94922b6824722a2b478c154cdc48575a8a1f66cd876f8cc9
4
+ data.tar.gz: 460fb758e2cac6b16391e392a33871f51050c8a63d3c79a0f49da654b29af132
5
5
  SHA512:
6
- metadata.gz: ff9252a6a4e94ec2a82555005d1807e1588aed1f8877685915029bff91f4c2cf63f9d7577d0d866bbfa8de7c374fb2eb9fd3b287d4a6c0c063778eb9de0a8879
7
- data.tar.gz: 1efc7aa6d95520cedb839cda9d359fd3194dde3c6cf9a072708d474c4981a47ff47d1243ea0fbad605ca5ea04f18ade2fb4cc9ff5141c5e1fc22d52f7f43a165
6
+ metadata.gz: 0e99ef34b2fe7f837cda9ea2bdee9287cc3e768bf254e9d290cfbdc83ef51ff7916bfc06ac16cb290d1cd647405284c975f6c5e3bbb3f0c7b3fb1f1924762dfa
7
+ data.tar.gz: eae4c47b3a76b1911f9a2ee3c2fa8fdfe8d2c5ddc04a2d3d82556e351e7bfcb9f04b82bc91e9610779d8e4873e36eec8a5b3bd5dbccd8e9f5d22635c385e3f73
data/README.md CHANGED
@@ -6,8 +6,8 @@ Moonlogs API
6
6
 
7
7
  This SDK is automatically generated by the [Swagger Codegen](https://github.com/swagger-api/swagger-codegen) project:
8
8
 
9
- - API version: 1.18.5
10
- - Package version: 1.18.5
9
+ - API version: 1.18.6
10
+ - Package version: 1.18.6
11
11
  - Build package: io.swagger.codegen.v3.generators.ruby.RubyClientCodegen
12
12
 
13
13
  ## Installation
@@ -23,15 +23,15 @@ gem build moonlogs-ruby.gemspec
23
23
  Then either install the gem locally:
24
24
 
25
25
  ```shell
26
- gem install ./moonlogs-ruby-1.18.5.gem
26
+ gem install ./moonlogs-ruby-1.18.6.gem
27
27
  ```
28
- (for development, run `gem install --dev ./moonlogs-ruby-1.18.5.gem` to install the development dependencies)
28
+ (for development, run `gem install --dev ./moonlogs-ruby-1.18.6.gem` to install the development dependencies)
29
29
 
30
30
  or publish the gem to a gem hosting service, e.g. [RubyGems](https://rubygems.org/).
31
31
 
32
32
  Finally add this to the Gemfile:
33
33
 
34
- gem 'moonlogs-ruby', '~> 1.18.5'
34
+ gem 'moonlogs-ruby', '~> 1.18.6'
35
35
 
36
36
  ### Install from Git
37
37
 
@@ -492,6 +492,21 @@ end
492
492
  MoonlogsRuby.configure do |config|
493
493
  end
494
494
 
495
+ api_instance = MoonlogsRuby::DefaultApi.new
496
+ opts = {
497
+ body: MoonlogsRuby::IncidentSearchRequest.new # IncidentSearchRequest |
498
+ }
499
+
500
+ begin
501
+ result = api_instance.search_incidents(opts)
502
+ p result
503
+ rescue MoonlogsRuby::ApiError => e
504
+ puts "Exception when calling DefaultApi->search_incidents: #{e}"
505
+ end
506
+ # Setup authorization
507
+ MoonlogsRuby.configure do |config|
508
+ end
509
+
495
510
  api_instance = MoonlogsRuby::DefaultApi.new
496
511
  opts = {
497
512
  body: MoonlogsRuby::RecordRequest.new, # RecordRequest |
@@ -626,6 +641,7 @@ Class | Method | HTTP request | Description
626
641
  *MoonlogsRuby::DefaultApi* | [**get_user_by_id**](docs/DefaultApi.md#get_user_by_id) | **GET** /api/users/{id} |
627
642
  *MoonlogsRuby::DefaultApi* | [**get_users**](docs/DefaultApi.md#get_users) | **GET** /api/users |
628
643
  *MoonlogsRuby::DefaultApi* | [**register_admin**](docs/DefaultApi.md#register_admin) | **POST** /api/setup/register_admin |
644
+ *MoonlogsRuby::DefaultApi* | [**search_incidents**](docs/DefaultApi.md#search_incidents) | **POST** /api/incidents/search |
629
645
  *MoonlogsRuby::DefaultApi* | [**search_logs**](docs/DefaultApi.md#search_logs) | **POST** /api/logs/search |
630
646
  *MoonlogsRuby::DefaultApi* | [**update_action_by_id**](docs/DefaultApi.md#update_action_by_id) | **PUT** /api/actions/{id} |
631
647
  *MoonlogsRuby::DefaultApi* | [**update_schema_by_id**](docs/DefaultApi.md#update_schema_by_id) | **PUT** /api/schemas/{id} |
@@ -641,6 +657,8 @@ Class | Method | HTTP request | Description
641
657
  - [MoonlogsRuby::ApiTokenResponse](docs/ApiTokenResponse.md)
642
658
  - [MoonlogsRuby::Condition](docs/Condition.md)
643
659
  - [MoonlogsRuby::Credentials](docs/Credentials.md)
660
+ - [MoonlogsRuby::IncidentResponse](docs/IncidentResponse.md)
661
+ - [MoonlogsRuby::IncidentSearchRequest](docs/IncidentSearchRequest.md)
644
662
  - [MoonlogsRuby::InlineResponse200](docs/InlineResponse200.md)
645
663
  - [MoonlogsRuby::InlineResponse2001](docs/InlineResponse2001.md)
646
664
  - [MoonlogsRuby::InlineResponse20010](docs/InlineResponse20010.md)
@@ -654,6 +672,7 @@ Class | Method | HTTP request | Description
654
672
  - [MoonlogsRuby::InlineResponse20018](docs/InlineResponse20018.md)
655
673
  - [MoonlogsRuby::InlineResponse20019](docs/InlineResponse20019.md)
656
674
  - [MoonlogsRuby::InlineResponse2002](docs/InlineResponse2002.md)
675
+ - [MoonlogsRuby::InlineResponse20020](docs/InlineResponse20020.md)
657
676
  - [MoonlogsRuby::InlineResponse2003](docs/InlineResponse2003.md)
658
677
  - [MoonlogsRuby::InlineResponse2004](docs/InlineResponse2004.md)
659
678
  - [MoonlogsRuby::InlineResponse2005](docs/InlineResponse2005.md)
data/docs/DefaultApi.md CHANGED
@@ -36,6 +36,7 @@ Method | HTTP request | Description
36
36
  [**get_user_by_id**](DefaultApi.md#get_user_by_id) | **GET** /api/users/{id} |
37
37
  [**get_users**](DefaultApi.md#get_users) | **GET** /api/users |
38
38
  [**register_admin**](DefaultApi.md#register_admin) | **POST** /api/setup/register_admin |
39
+ [**search_incidents**](DefaultApi.md#search_incidents) | **POST** /api/incidents/search |
39
40
  [**search_logs**](DefaultApi.md#search_logs) | **POST** /api/logs/search |
40
41
  [**update_action_by_id**](DefaultApi.md#update_action_by_id) | **PUT** /api/actions/{id} |
41
42
  [**update_schema_by_id**](DefaultApi.md#update_schema_by_id) | **PUT** /api/schemas/{id} |
@@ -1480,6 +1481,53 @@ No authorization required
1480
1481
 
1481
1482
 
1482
1483
 
1484
+ # **search_incidents**
1485
+ > InlineResponse20020 search_incidents(opts)
1486
+
1487
+
1488
+
1489
+ ### Example
1490
+ ```ruby
1491
+ # load the gem
1492
+ require 'moonlogs-ruby'
1493
+ # setup authorization
1494
+ MoonlogsRuby.configure do |config|
1495
+ end
1496
+
1497
+ api_instance = MoonlogsRuby::DefaultApi.new
1498
+ opts = {
1499
+ body: MoonlogsRuby::IncidentSearchRequest.new # IncidentSearchRequest |
1500
+ }
1501
+
1502
+ begin
1503
+ result = api_instance.search_incidents(opts)
1504
+ p result
1505
+ rescue MoonlogsRuby::ApiError => e
1506
+ puts "Exception when calling DefaultApi->search_incidents: #{e}"
1507
+ end
1508
+ ```
1509
+
1510
+ ### Parameters
1511
+
1512
+ Name | Type | Description | Notes
1513
+ ------------- | ------------- | ------------- | -------------
1514
+ **body** | [**IncidentSearchRequest**](IncidentSearchRequest.md)| | [optional]
1515
+
1516
+ ### Return type
1517
+
1518
+ [**InlineResponse20020**](InlineResponse20020.md)
1519
+
1520
+ ### Authorization
1521
+
1522
+ [http1](../README.md#http1)
1523
+
1524
+ ### HTTP request headers
1525
+
1526
+ - **Content-Type**: application/json
1527
+ - **Accept**: application/json
1528
+
1529
+
1530
+
1483
1531
  # **search_logs**
1484
1532
  > InlineResponse2003 search_logs(opts)
1485
1533
 
@@ -0,0 +1,12 @@
1
+ # MoonlogsRuby::IncidentResponse
2
+
3
+ ## Properties
4
+ Name | Type | Description | Notes
5
+ ------------ | ------------- | ------------- | -------------
6
+ **id** | **Integer** | |
7
+ **rule_name** | **String** | |
8
+ **rule_id** | **Integer** | |
9
+ **keys** | **Object** | |
10
+ **count** | **Integer** | |
11
+ **ttl** | **DateTime** | ISO8601 date-time |
12
+
@@ -0,0 +1,7 @@
1
+ # MoonlogsRuby::IncidentSearchRequest
2
+
3
+ ## Properties
4
+ Name | Type | Description | Notes
5
+ ------------ | ------------- | ------------- | -------------
6
+ **keys** | **Object** | | [optional]
7
+
@@ -0,0 +1,11 @@
1
+ # MoonlogsRuby::InlineResponse20020
2
+
3
+ ## Properties
4
+ Name | Type | Description | Notes
5
+ ------------ | ------------- | ------------- | -------------
6
+ **success** | **BOOLEAN** | |
7
+ **code** | **Integer** | |
8
+ **error** | **String** | |
9
+ **data** | [**Array<IncidentResponse>**](IncidentResponse.md) | |
10
+ **meta** | [**Meta**](Meta.md) | |
11
+
@@ -3,7 +3,7 @@
3
3
 
4
4
  #Moonlogs API
5
5
 
6
- OpenAPI spec version: 1.18.5
6
+ OpenAPI spec version: 1.18.6
7
7
  Contact: shalpack@gmail.com
8
8
  Generated by: https://github.com/swagger-api/swagger-codegen.git
9
9
  Swagger Codegen version: 3.0.52
@@ -1621,6 +1621,56 @@ module MoonlogsRuby
1621
1621
  return data, status_code, headers
1622
1622
  end
1623
1623
  # @param [Hash] opts the optional parameters
1624
+ # @option opts [IncidentSearchRequest] :body
1625
+ # @return [InlineResponse20020]
1626
+ def search_incidents(opts = {})
1627
+ data, _status_code, _headers = search_incidents_with_http_info(opts)
1628
+ data
1629
+ end
1630
+
1631
+ # @param [Hash] opts the optional parameters
1632
+ # @option opts [IncidentSearchRequest] :body
1633
+ # @return [Array<(InlineResponse20020, Integer, Hash)>] InlineResponse20020 data, response status code and response headers
1634
+ def search_incidents_with_http_info(opts = {})
1635
+ if @api_client.config.debugging
1636
+ @api_client.config.logger.debug 'Calling API: DefaultApi.search_incidents ...'
1637
+ end
1638
+ # resource path
1639
+ local_var_path = '/api/incidents/search'
1640
+
1641
+ # query parameters
1642
+ query_params = opts[:query_params] || {}
1643
+
1644
+ # header parameters
1645
+ header_params = opts[:header_params] || {}
1646
+ # HTTP header 'Accept' (if needed)
1647
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
1648
+ # HTTP header 'Content-Type'
1649
+ header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
1650
+
1651
+ # form parameters
1652
+ form_params = opts[:form_params] || {}
1653
+
1654
+ # http body (model)
1655
+ post_body = opts[:body] || @api_client.object_to_http_body(opts[:'body'])
1656
+
1657
+ return_type = opts[:return_type] || 'InlineResponse20020'
1658
+
1659
+ auth_names = opts[:auth_names] || ['http1']
1660
+ data, status_code, headers = @api_client.call_api(:POST, local_var_path,
1661
+ :header_params => header_params,
1662
+ :query_params => query_params,
1663
+ :form_params => form_params,
1664
+ :body => post_body,
1665
+ :auth_names => auth_names,
1666
+ :return_type => return_type)
1667
+
1668
+ if @api_client.config.debugging
1669
+ @api_client.config.logger.debug "API called: DefaultApi#search_incidents\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
1670
+ end
1671
+ return data, status_code, headers
1672
+ end
1673
+ # @param [Hash] opts the optional parameters
1624
1674
  # @option opts [RecordRequest] :body
1625
1675
  # @option opts [Integer] :page
1626
1676
  # @option opts [Integer] :limit
@@ -3,7 +3,7 @@
3
3
 
4
4
  #Moonlogs API
5
5
 
6
- OpenAPI spec version: 1.18.5
6
+ OpenAPI spec version: 1.18.6
7
7
  Contact: shalpack@gmail.com
8
8
  Generated by: https://github.com/swagger-api/swagger-codegen.git
9
9
  Swagger Codegen version: 3.0.52
@@ -3,7 +3,7 @@
3
3
 
4
4
  #Moonlogs API
5
5
 
6
- OpenAPI spec version: 1.18.5
6
+ OpenAPI spec version: 1.18.6
7
7
  Contact: shalpack@gmail.com
8
8
  Generated by: https://github.com/swagger-api/swagger-codegen.git
9
9
  Swagger Codegen version: 3.0.52
@@ -3,7 +3,7 @@
3
3
 
4
4
  #Moonlogs API
5
5
 
6
- OpenAPI spec version: 1.18.5
6
+ OpenAPI spec version: 1.18.6
7
7
  Contact: shalpack@gmail.com
8
8
  Generated by: https://github.com/swagger-api/swagger-codegen.git
9
9
  Swagger Codegen version: 3.0.52
@@ -3,7 +3,7 @@
3
3
 
4
4
  #Moonlogs API
5
5
 
6
- OpenAPI spec version: 1.18.5
6
+ OpenAPI spec version: 1.18.6
7
7
  Contact: shalpack@gmail.com
8
8
  Generated by: https://github.com/swagger-api/swagger-codegen.git
9
9
  Swagger Codegen version: 3.0.52
@@ -3,7 +3,7 @@
3
3
 
4
4
  #Moonlogs API
5
5
 
6
- OpenAPI spec version: 1.18.5
6
+ OpenAPI spec version: 1.18.6
7
7
  Contact: shalpack@gmail.com
8
8
  Generated by: https://github.com/swagger-api/swagger-codegen.git
9
9
  Swagger Codegen version: 3.0.52
@@ -3,7 +3,7 @@
3
3
 
4
4
  #Moonlogs API
5
5
 
6
- OpenAPI spec version: 1.18.5
6
+ OpenAPI spec version: 1.18.6
7
7
  Contact: shalpack@gmail.com
8
8
  Generated by: https://github.com/swagger-api/swagger-codegen.git
9
9
  Swagger Codegen version: 3.0.52
@@ -3,7 +3,7 @@
3
3
 
4
4
  #Moonlogs API
5
5
 
6
- OpenAPI spec version: 1.18.5
6
+ OpenAPI spec version: 1.18.6
7
7
  Contact: shalpack@gmail.com
8
8
  Generated by: https://github.com/swagger-api/swagger-codegen.git
9
9
  Swagger Codegen version: 3.0.52
@@ -3,7 +3,7 @@
3
3
 
4
4
  #Moonlogs API
5
5
 
6
- OpenAPI spec version: 1.18.5
6
+ OpenAPI spec version: 1.18.6
7
7
  Contact: shalpack@gmail.com
8
8
  Generated by: https://github.com/swagger-api/swagger-codegen.git
9
9
  Swagger Codegen version: 3.0.52
@@ -3,7 +3,7 @@
3
3
 
4
4
  #Moonlogs API
5
5
 
6
- OpenAPI spec version: 1.18.5
6
+ OpenAPI spec version: 1.18.6
7
7
  Contact: shalpack@gmail.com
8
8
  Generated by: https://github.com/swagger-api/swagger-codegen.git
9
9
  Swagger Codegen version: 3.0.52
@@ -0,0 +1,282 @@
1
+ =begin
2
+ #Moonlogs
3
+
4
+ #Moonlogs API
5
+
6
+ OpenAPI spec version: 1.18.6
7
+ Contact: shalpack@gmail.com
8
+ Generated by: https://github.com/swagger-api/swagger-codegen.git
9
+ Swagger Codegen version: 3.0.52
10
+ =end
11
+
12
+ require 'date'
13
+
14
+ module MoonlogsRuby
15
+ class IncidentResponse
16
+ attr_accessor :id
17
+
18
+ attr_accessor :rule_name
19
+
20
+ attr_accessor :rule_id
21
+
22
+ attr_accessor :keys
23
+
24
+ attr_accessor :count
25
+
26
+ # ISO8601 date-time
27
+ attr_accessor :ttl
28
+
29
+ # Attribute mapping from ruby-style variable name to JSON key.
30
+ def self.attribute_map
31
+ {
32
+ :'id' => :'id',
33
+ :'rule_name' => :'rule_name',
34
+ :'rule_id' => :'rule_id',
35
+ :'keys' => :'keys',
36
+ :'count' => :'count',
37
+ :'ttl' => :'ttl'
38
+ }
39
+ end
40
+
41
+ # Attribute type mapping.
42
+ def self.openapi_types
43
+ {
44
+ :'id' => :'Object',
45
+ :'rule_name' => :'Object',
46
+ :'rule_id' => :'Object',
47
+ :'keys' => :'Object',
48
+ :'count' => :'Object',
49
+ :'ttl' => :'Object'
50
+ }
51
+ end
52
+
53
+ # List of attributes with nullable: true
54
+ def self.openapi_nullable
55
+ Set.new([
56
+ ])
57
+ end
58
+
59
+ # Initializes the object
60
+ # @param [Hash] attributes Model attributes in the form of hash
61
+ def initialize(attributes = {})
62
+ if (!attributes.is_a?(Hash))
63
+ fail ArgumentError, "The input argument (attributes) must be a hash in `MoonlogsRuby::IncidentResponse` initialize method"
64
+ end
65
+
66
+ # check to see if the attribute exists and convert string to symbol for hash key
67
+ attributes = attributes.each_with_object({}) { |(k, v), h|
68
+ if (!self.class.attribute_map.key?(k.to_sym))
69
+ fail ArgumentError, "`#{k}` is not a valid attribute in `MoonlogsRuby::IncidentResponse`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
70
+ end
71
+ h[k.to_sym] = v
72
+ }
73
+
74
+ if attributes.key?(:'id')
75
+ self.id = attributes[:'id']
76
+ end
77
+
78
+ if attributes.key?(:'rule_name')
79
+ self.rule_name = attributes[:'rule_name']
80
+ end
81
+
82
+ if attributes.key?(:'rule_id')
83
+ self.rule_id = attributes[:'rule_id']
84
+ end
85
+
86
+ if attributes.key?(:'keys')
87
+ self.keys = attributes[:'keys']
88
+ end
89
+
90
+ if attributes.key?(:'count')
91
+ self.count = attributes[:'count']
92
+ end
93
+
94
+ if attributes.key?(:'ttl')
95
+ self.ttl = attributes[:'ttl']
96
+ end
97
+ end
98
+
99
+ # Show invalid properties with the reasons. Usually used together with valid?
100
+ # @return Array for valid properties with the reasons
101
+ def list_invalid_properties
102
+ invalid_properties = Array.new
103
+ if @id.nil?
104
+ invalid_properties.push('invalid value for "id", id cannot be nil.')
105
+ end
106
+
107
+ if @rule_name.nil?
108
+ invalid_properties.push('invalid value for "rule_name", rule_name cannot be nil.')
109
+ end
110
+
111
+ if @rule_id.nil?
112
+ invalid_properties.push('invalid value for "rule_id", rule_id cannot be nil.')
113
+ end
114
+
115
+ if @keys.nil?
116
+ invalid_properties.push('invalid value for "keys", keys cannot be nil.')
117
+ end
118
+
119
+ if @count.nil?
120
+ invalid_properties.push('invalid value for "count", count cannot be nil.')
121
+ end
122
+
123
+ if @ttl.nil?
124
+ invalid_properties.push('invalid value for "ttl", ttl cannot be nil.')
125
+ end
126
+
127
+ invalid_properties
128
+ end
129
+
130
+ # Check to see if the all the properties in the model are valid
131
+ # @return true if the model is valid
132
+ def valid?
133
+ return false if @id.nil?
134
+ return false if @rule_name.nil?
135
+ return false if @rule_id.nil?
136
+ return false if @keys.nil?
137
+ return false if @count.nil?
138
+ return false if @ttl.nil?
139
+ true
140
+ end
141
+
142
+ # Checks equality by comparing each attribute.
143
+ # @param [Object] Object to be compared
144
+ def ==(o)
145
+ return true if self.equal?(o)
146
+ self.class == o.class &&
147
+ id == o.id &&
148
+ rule_name == o.rule_name &&
149
+ rule_id == o.rule_id &&
150
+ keys == o.keys &&
151
+ count == o.count &&
152
+ ttl == o.ttl
153
+ end
154
+
155
+ # @see the `==` method
156
+ # @param [Object] Object to be compared
157
+ def eql?(o)
158
+ self == o
159
+ end
160
+
161
+ # Calculates hash code according to all attributes.
162
+ # @return [Integer] Hash code
163
+ def hash
164
+ [id, rule_name, rule_id, keys, count, ttl].hash
165
+ end
166
+
167
+ # Builds the object from hash
168
+ # @param [Hash] attributes Model attributes in the form of hash
169
+ # @return [Object] Returns the model itself
170
+ def self.build_from_hash(attributes)
171
+ new.build_from_hash(attributes)
172
+ end
173
+
174
+ # Builds the object from hash
175
+ # @param [Hash] attributes Model attributes in the form of hash
176
+ # @return [Object] Returns the model itself
177
+ def build_from_hash(attributes)
178
+ return nil unless attributes.is_a?(Hash)
179
+ self.class.openapi_types.each_pair do |key, type|
180
+ if type =~ /\AArray<(.*)>/i
181
+ # check to ensure the input is an array given that the attribute
182
+ # is documented as an array but the input is not
183
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
184
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
185
+ end
186
+ elsif !attributes[self.class.attribute_map[key]].nil?
187
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
188
+ elsif attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
189
+ self.send("#{key}=", nil)
190
+ end
191
+ end
192
+
193
+ self
194
+ end
195
+
196
+ # Deserializes the data based on type
197
+ # @param string type Data type
198
+ # @param string value Value to be deserialized
199
+ # @return [Object] Deserialized data
200
+ def _deserialize(type, value)
201
+ case type.to_sym
202
+ when :DateTime
203
+ DateTime.parse(value)
204
+ when :Date
205
+ Date.parse(value)
206
+ when :String
207
+ value.to_s
208
+ when :Integer
209
+ value.to_i
210
+ when :Float
211
+ value.to_f
212
+ when :Boolean
213
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
214
+ true
215
+ else
216
+ false
217
+ end
218
+ when :Object
219
+ # generic object (usually a Hash), return directly
220
+ value
221
+ when /\AArray<(?<inner_type>.+)>\z/
222
+ inner_type = Regexp.last_match[:inner_type]
223
+ value.map { |v| _deserialize(inner_type, v) }
224
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
225
+ k_type = Regexp.last_match[:k_type]
226
+ v_type = Regexp.last_match[:v_type]
227
+ {}.tap do |hash|
228
+ value.each do |k, v|
229
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
230
+ end
231
+ end
232
+ else # model
233
+ MoonlogsRuby.const_get(type).build_from_hash(value)
234
+ end
235
+ end
236
+
237
+ # Returns the string representation of the object
238
+ # @return [String] String presentation of the object
239
+ def to_s
240
+ to_hash.to_s
241
+ end
242
+
243
+ # to_body is an alias to to_hash (backward compatibility)
244
+ # @return [Hash] Returns the object in the form of hash
245
+ def to_body
246
+ to_hash
247
+ end
248
+
249
+ # Returns the object in the form of hash
250
+ # @return [Hash] Returns the object in the form of hash
251
+ def to_hash
252
+ hash = {}
253
+ self.class.attribute_map.each_pair do |attr, param|
254
+ value = self.send(attr)
255
+ if value.nil?
256
+ is_nullable = self.class.openapi_nullable.include?(attr)
257
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
258
+ end
259
+
260
+ hash[param] = _to_hash(value)
261
+ end
262
+ hash
263
+ end
264
+
265
+ # Outputs non-array value in the form of hash
266
+ # For object, use to_hash. Otherwise, just return the value
267
+ # @param [Object] value Any valid value
268
+ # @return [Hash] Returns the value in the form of hash
269
+ def _to_hash(value)
270
+ if value.is_a?(Array)
271
+ value.compact.map { |v| _to_hash(v) }
272
+ elsif value.is_a?(Hash)
273
+ {}.tap do |hash|
274
+ value.each { |k, v| hash[k] = _to_hash(v) }
275
+ end
276
+ elsif value.respond_to? :to_hash
277
+ value.to_hash
278
+ else
279
+ value
280
+ end
281
+ end end
282
+ end