pulp_ostree_client 2.2.1 → 2.3.1

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 (99) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +23 -4
  3. data/docs/ContentCommitsApi.md +2 -0
  4. data/docs/ContentConfigsApi.md +2 -0
  5. data/docs/ContentContentApi.md +56 -0
  6. data/docs/ContentObjectsApi.md +2 -0
  7. data/docs/ContentRefsApi.md +2 -0
  8. data/docs/ContentSummariesApi.md +2 -0
  9. data/docs/DistributionsOstreeApi.md +232 -0
  10. data/docs/MyPermissionsResponse.md +17 -0
  11. data/docs/NestedRole.md +21 -0
  12. data/docs/NestedRoleResponse.md +21 -0
  13. data/docs/ObjectRolesResponse.md +17 -0
  14. data/docs/OstreeOstreeCommitResponse.md +2 -0
  15. data/docs/OstreeOstreeConfigResponse.md +2 -0
  16. data/docs/OstreeOstreeContent.md +23 -0
  17. data/docs/OstreeOstreeContentResponse.md +2 -0
  18. data/docs/OstreeOstreeDistributionResponse.md +2 -0
  19. data/docs/OstreeOstreeObjectResponse.md +2 -0
  20. data/docs/OstreeOstreeRefResponse.md +2 -0
  21. data/docs/OstreeOstreeRemoteResponse.md +2 -2
  22. data/docs/OstreeOstreeRemoteResponseHiddenFields.md +2 -2
  23. data/docs/OstreeOstreeRepositoryResponse.md +2 -0
  24. data/docs/OstreeOstreeSummaryResponse.md +2 -0
  25. data/docs/PaginatedRepositoryVersionResponseList.md +2 -2
  26. data/docs/PaginatedostreeOstreeCommitResponseList.md +2 -2
  27. data/docs/PaginatedostreeOstreeConfigResponseList.md +2 -2
  28. data/docs/PaginatedostreeOstreeContentResponseList.md +2 -2
  29. data/docs/PaginatedostreeOstreeDistributionResponseList.md +2 -2
  30. data/docs/PaginatedostreeOstreeObjectResponseList.md +2 -2
  31. data/docs/PaginatedostreeOstreeRefResponseList.md +2 -2
  32. data/docs/PaginatedostreeOstreeRemoteResponseList.md +2 -2
  33. data/docs/PaginatedostreeOstreeRepositoryResponseList.md +2 -2
  34. data/docs/PaginatedostreeOstreeSummaryResponseList.md +2 -2
  35. data/docs/RemotesOstreeApi.md +232 -0
  36. data/docs/RepositoriesOstreeApi.md +232 -0
  37. data/docs/RepositoryVersionResponse.md +2 -0
  38. data/lib/pulp_ostree_client/api/content_commits_api.rb +3 -0
  39. data/lib/pulp_ostree_client/api/content_configs_api.rb +3 -0
  40. data/lib/pulp_ostree_client/api/content_content_api.rb +67 -0
  41. data/lib/pulp_ostree_client/api/content_objects_api.rb +3 -0
  42. data/lib/pulp_ostree_client/api/content_refs_api.rb +3 -0
  43. data/lib/pulp_ostree_client/api/content_summaries_api.rb +3 -0
  44. data/lib/pulp_ostree_client/api/distributions_ostree_api.rb +276 -0
  45. data/lib/pulp_ostree_client/api/remotes_ostree_api.rb +276 -0
  46. data/lib/pulp_ostree_client/api/repositories_ostree_api.rb +276 -0
  47. data/lib/pulp_ostree_client/models/my_permissions_response.rb +213 -0
  48. data/lib/pulp_ostree_client/models/nested_role.rb +253 -0
  49. data/lib/pulp_ostree_client/models/nested_role_response.rb +234 -0
  50. data/lib/pulp_ostree_client/models/object_roles_response.rb +213 -0
  51. data/lib/pulp_ostree_client/models/ostree_ostree_commit_response.rb +11 -1
  52. data/lib/pulp_ostree_client/models/ostree_ostree_config_response.rb +11 -1
  53. data/lib/pulp_ostree_client/models/ostree_ostree_content.rb +289 -0
  54. data/lib/pulp_ostree_client/models/ostree_ostree_content_response.rb +11 -1
  55. data/lib/pulp_ostree_client/models/ostree_ostree_distribution_response.rb +11 -1
  56. data/lib/pulp_ostree_client/models/ostree_ostree_object_response.rb +11 -1
  57. data/lib/pulp_ostree_client/models/ostree_ostree_ref_response.rb +11 -1
  58. data/lib/pulp_ostree_client/models/ostree_ostree_remote_response.rb +11 -11
  59. data/lib/pulp_ostree_client/models/ostree_ostree_remote_response_hidden_fields.rb +10 -0
  60. data/lib/pulp_ostree_client/models/ostree_ostree_repository_response.rb +11 -1
  61. data/lib/pulp_ostree_client/models/ostree_ostree_summary_response.rb +11 -1
  62. data/lib/pulp_ostree_client/models/paginated_repository_version_response_list.rb +10 -0
  63. data/lib/pulp_ostree_client/models/paginatedostree_ostree_commit_response_list.rb +10 -0
  64. data/lib/pulp_ostree_client/models/paginatedostree_ostree_config_response_list.rb +10 -0
  65. data/lib/pulp_ostree_client/models/paginatedostree_ostree_content_response_list.rb +10 -0
  66. data/lib/pulp_ostree_client/models/paginatedostree_ostree_distribution_response_list.rb +10 -0
  67. data/lib/pulp_ostree_client/models/paginatedostree_ostree_object_response_list.rb +10 -0
  68. data/lib/pulp_ostree_client/models/paginatedostree_ostree_ref_response_list.rb +10 -0
  69. data/lib/pulp_ostree_client/models/paginatedostree_ostree_remote_response_list.rb +10 -0
  70. data/lib/pulp_ostree_client/models/paginatedostree_ostree_repository_response_list.rb +10 -0
  71. data/lib/pulp_ostree_client/models/paginatedostree_ostree_summary_response_list.rb +10 -0
  72. data/lib/pulp_ostree_client/models/repository_version_response.rb +11 -1
  73. data/lib/pulp_ostree_client/version.rb +1 -1
  74. data/lib/pulp_ostree_client.rb +5 -0
  75. data/spec/api/content_commits_api_spec.rb +1 -0
  76. data/spec/api/content_configs_api_spec.rb +1 -0
  77. data/spec/api/content_content_api_spec.rb +13 -0
  78. data/spec/api/content_objects_api_spec.rb +1 -0
  79. data/spec/api/content_refs_api_spec.rb +1 -0
  80. data/spec/api/content_summaries_api_spec.rb +1 -0
  81. data/spec/api/distributions_ostree_api_spec.rb +54 -0
  82. data/spec/api/remotes_ostree_api_spec.rb +54 -0
  83. data/spec/api/repositories_ostree_api_spec.rb +54 -0
  84. data/spec/models/my_permissions_response_spec.rb +41 -0
  85. data/spec/models/nested_role_response_spec.rb +53 -0
  86. data/spec/models/nested_role_spec.rb +53 -0
  87. data/spec/models/object_roles_response_spec.rb +41 -0
  88. data/spec/models/ostree_ostree_commit_response_spec.rb +6 -0
  89. data/spec/models/ostree_ostree_config_response_spec.rb +6 -0
  90. data/spec/models/ostree_ostree_content_response_spec.rb +6 -0
  91. data/spec/models/ostree_ostree_content_spec.rb +59 -0
  92. data/spec/models/ostree_ostree_distribution_response_spec.rb +6 -0
  93. data/spec/models/ostree_ostree_object_response_spec.rb +6 -0
  94. data/spec/models/ostree_ostree_ref_response_spec.rb +6 -0
  95. data/spec/models/ostree_ostree_remote_response_spec.rb +6 -6
  96. data/spec/models/ostree_ostree_repository_response_spec.rb +6 -0
  97. data/spec/models/ostree_ostree_summary_response_spec.rb +6 -0
  98. data/spec/models/repository_version_response_spec.rb +6 -0
  99. metadata +55 -35
@@ -19,6 +19,76 @@ module PulpOstreeClient
19
19
  def initialize(api_client = ApiClient.default)
20
20
  @api_client = api_client
21
21
  end
22
+ # Add a role
23
+ # Add a role for this object to users/groups.
24
+ # @param ostree_ostree_repository_href [String]
25
+ # @param nested_role [NestedRole]
26
+ # @param [Hash] opts the optional parameters
27
+ # @return [NestedRoleResponse]
28
+ def add_role(ostree_ostree_repository_href, nested_role, opts = {})
29
+ data, _status_code, _headers = add_role_with_http_info(ostree_ostree_repository_href, nested_role, opts)
30
+ data
31
+ end
32
+
33
+ # Add a role
34
+ # Add a role for this object to users/groups.
35
+ # @param ostree_ostree_repository_href [String]
36
+ # @param nested_role [NestedRole]
37
+ # @param [Hash] opts the optional parameters
38
+ # @return [Array<(NestedRoleResponse, Integer, Hash)>] NestedRoleResponse data, response status code and response headers
39
+ def add_role_with_http_info(ostree_ostree_repository_href, nested_role, opts = {})
40
+ if @api_client.config.debugging
41
+ @api_client.config.logger.debug 'Calling API: RepositoriesOstreeApi.add_role ...'
42
+ end
43
+ # verify the required parameter 'ostree_ostree_repository_href' is set
44
+ if @api_client.config.client_side_validation && ostree_ostree_repository_href.nil?
45
+ fail ArgumentError, "Missing the required parameter 'ostree_ostree_repository_href' when calling RepositoriesOstreeApi.add_role"
46
+ end
47
+ # verify the required parameter 'nested_role' is set
48
+ if @api_client.config.client_side_validation && nested_role.nil?
49
+ fail ArgumentError, "Missing the required parameter 'nested_role' when calling RepositoriesOstreeApi.add_role"
50
+ end
51
+ # resource path
52
+ local_var_path = '{ostree_ostree_repository_href}add_role/'.sub('{' + 'ostree_ostree_repository_href' + '}', CGI.escape(ostree_ostree_repository_href.to_s).gsub('%2F', '/'))
53
+
54
+ # query parameters
55
+ query_params = opts[:query_params] || {}
56
+
57
+ # header parameters
58
+ header_params = opts[:header_params] || {}
59
+ # HTTP header 'Accept' (if needed)
60
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
61
+ # HTTP header 'Content-Type'
62
+ header_params['Content-Type'] = @api_client.select_header_content_type(['application/json', 'application/x-www-form-urlencoded', 'multipart/form-data'])
63
+
64
+ # form parameters
65
+ form_params = opts[:form_params] || {}
66
+
67
+ # http body (model)
68
+ post_body = opts[:body] || @api_client.object_to_http_body(nested_role)
69
+
70
+ # return_type
71
+ return_type = opts[:return_type] || 'NestedRoleResponse'
72
+
73
+ # auth_names
74
+ auth_names = opts[:auth_names] || ['basicAuth']
75
+
76
+ new_options = opts.merge(
77
+ :header_params => header_params,
78
+ :query_params => query_params,
79
+ :form_params => form_params,
80
+ :body => post_body,
81
+ :auth_names => auth_names,
82
+ :return_type => return_type
83
+ )
84
+
85
+ data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
86
+ if @api_client.config.debugging
87
+ @api_client.config.logger.debug "API called: RepositoriesOstreeApi#add_role\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
88
+ end
89
+ return data, status_code, headers
90
+ end
91
+
22
92
  # Create an ostree repository
23
93
  # A ViewSet class for OSTree repositories.
24
94
  # @param ostree_ostree_repository [OstreeOstreeRepository]
@@ -432,6 +502,74 @@ module PulpOstreeClient
432
502
  return data, status_code, headers
433
503
  end
434
504
 
505
+ # List roles
506
+ # List roles assigned to this object.
507
+ # @param ostree_ostree_repository_href [String]
508
+ # @param [Hash] opts the optional parameters
509
+ # @option opts [Array<String>] :fields A list of fields to include in the response.
510
+ # @option opts [Array<String>] :exclude_fields A list of fields to exclude from the response.
511
+ # @return [ObjectRolesResponse]
512
+ def list_roles(ostree_ostree_repository_href, opts = {})
513
+ data, _status_code, _headers = list_roles_with_http_info(ostree_ostree_repository_href, opts)
514
+ data
515
+ end
516
+
517
+ # List roles
518
+ # List roles assigned to this object.
519
+ # @param ostree_ostree_repository_href [String]
520
+ # @param [Hash] opts the optional parameters
521
+ # @option opts [Array<String>] :fields A list of fields to include in the response.
522
+ # @option opts [Array<String>] :exclude_fields A list of fields to exclude from the response.
523
+ # @return [Array<(ObjectRolesResponse, Integer, Hash)>] ObjectRolesResponse data, response status code and response headers
524
+ def list_roles_with_http_info(ostree_ostree_repository_href, opts = {})
525
+ if @api_client.config.debugging
526
+ @api_client.config.logger.debug 'Calling API: RepositoriesOstreeApi.list_roles ...'
527
+ end
528
+ # verify the required parameter 'ostree_ostree_repository_href' is set
529
+ if @api_client.config.client_side_validation && ostree_ostree_repository_href.nil?
530
+ fail ArgumentError, "Missing the required parameter 'ostree_ostree_repository_href' when calling RepositoriesOstreeApi.list_roles"
531
+ end
532
+ # resource path
533
+ local_var_path = '{ostree_ostree_repository_href}list_roles/'.sub('{' + 'ostree_ostree_repository_href' + '}', CGI.escape(ostree_ostree_repository_href.to_s).gsub('%2F', '/'))
534
+
535
+ # query parameters
536
+ query_params = opts[:query_params] || {}
537
+ query_params[:'fields'] = @api_client.build_collection_param(opts[:'fields'], :multi) if !opts[:'fields'].nil?
538
+ query_params[:'exclude_fields'] = @api_client.build_collection_param(opts[:'exclude_fields'], :multi) if !opts[:'exclude_fields'].nil?
539
+
540
+ # header parameters
541
+ header_params = opts[:header_params] || {}
542
+ # HTTP header 'Accept' (if needed)
543
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
544
+
545
+ # form parameters
546
+ form_params = opts[:form_params] || {}
547
+
548
+ # http body (model)
549
+ post_body = opts[:body]
550
+
551
+ # return_type
552
+ return_type = opts[:return_type] || 'ObjectRolesResponse'
553
+
554
+ # auth_names
555
+ auth_names = opts[:auth_names] || ['basicAuth']
556
+
557
+ new_options = opts.merge(
558
+ :header_params => header_params,
559
+ :query_params => query_params,
560
+ :form_params => form_params,
561
+ :body => post_body,
562
+ :auth_names => auth_names,
563
+ :return_type => return_type
564
+ )
565
+
566
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
567
+ if @api_client.config.debugging
568
+ @api_client.config.logger.debug "API called: RepositoriesOstreeApi#list_roles\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
569
+ end
570
+ return data, status_code, headers
571
+ end
572
+
435
573
  # Modify repository
436
574
  # Trigger an asynchronous task to modify content.
437
575
  # @param ostree_ostree_repository_href [String]
@@ -502,6 +640,74 @@ module PulpOstreeClient
502
640
  return data, status_code, headers
503
641
  end
504
642
 
643
+ # List user permissions
644
+ # List permissions available to the current user on this object.
645
+ # @param ostree_ostree_repository_href [String]
646
+ # @param [Hash] opts the optional parameters
647
+ # @option opts [Array<String>] :fields A list of fields to include in the response.
648
+ # @option opts [Array<String>] :exclude_fields A list of fields to exclude from the response.
649
+ # @return [MyPermissionsResponse]
650
+ def my_permissions(ostree_ostree_repository_href, opts = {})
651
+ data, _status_code, _headers = my_permissions_with_http_info(ostree_ostree_repository_href, opts)
652
+ data
653
+ end
654
+
655
+ # List user permissions
656
+ # List permissions available to the current user on this object.
657
+ # @param ostree_ostree_repository_href [String]
658
+ # @param [Hash] opts the optional parameters
659
+ # @option opts [Array<String>] :fields A list of fields to include in the response.
660
+ # @option opts [Array<String>] :exclude_fields A list of fields to exclude from the response.
661
+ # @return [Array<(MyPermissionsResponse, Integer, Hash)>] MyPermissionsResponse data, response status code and response headers
662
+ def my_permissions_with_http_info(ostree_ostree_repository_href, opts = {})
663
+ if @api_client.config.debugging
664
+ @api_client.config.logger.debug 'Calling API: RepositoriesOstreeApi.my_permissions ...'
665
+ end
666
+ # verify the required parameter 'ostree_ostree_repository_href' is set
667
+ if @api_client.config.client_side_validation && ostree_ostree_repository_href.nil?
668
+ fail ArgumentError, "Missing the required parameter 'ostree_ostree_repository_href' when calling RepositoriesOstreeApi.my_permissions"
669
+ end
670
+ # resource path
671
+ local_var_path = '{ostree_ostree_repository_href}my_permissions/'.sub('{' + 'ostree_ostree_repository_href' + '}', CGI.escape(ostree_ostree_repository_href.to_s).gsub('%2F', '/'))
672
+
673
+ # query parameters
674
+ query_params = opts[:query_params] || {}
675
+ query_params[:'fields'] = @api_client.build_collection_param(opts[:'fields'], :multi) if !opts[:'fields'].nil?
676
+ query_params[:'exclude_fields'] = @api_client.build_collection_param(opts[:'exclude_fields'], :multi) if !opts[:'exclude_fields'].nil?
677
+
678
+ # header parameters
679
+ header_params = opts[:header_params] || {}
680
+ # HTTP header 'Accept' (if needed)
681
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
682
+
683
+ # form parameters
684
+ form_params = opts[:form_params] || {}
685
+
686
+ # http body (model)
687
+ post_body = opts[:body]
688
+
689
+ # return_type
690
+ return_type = opts[:return_type] || 'MyPermissionsResponse'
691
+
692
+ # auth_names
693
+ auth_names = opts[:auth_names] || ['basicAuth']
694
+
695
+ new_options = opts.merge(
696
+ :header_params => header_params,
697
+ :query_params => query_params,
698
+ :form_params => form_params,
699
+ :body => post_body,
700
+ :auth_names => auth_names,
701
+ :return_type => return_type
702
+ )
703
+
704
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
705
+ if @api_client.config.debugging
706
+ @api_client.config.logger.debug "API called: RepositoriesOstreeApi#my_permissions\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
707
+ end
708
+ return data, status_code, headers
709
+ end
710
+
505
711
  # Update an ostree repository
506
712
  # Trigger an asynchronous partial update task
507
713
  # @param ostree_ostree_repository_href [String]
@@ -640,6 +846,76 @@ module PulpOstreeClient
640
846
  return data, status_code, headers
641
847
  end
642
848
 
849
+ # Remove a role
850
+ # Remove a role for this object from users/groups.
851
+ # @param ostree_ostree_repository_href [String]
852
+ # @param nested_role [NestedRole]
853
+ # @param [Hash] opts the optional parameters
854
+ # @return [NestedRoleResponse]
855
+ def remove_role(ostree_ostree_repository_href, nested_role, opts = {})
856
+ data, _status_code, _headers = remove_role_with_http_info(ostree_ostree_repository_href, nested_role, opts)
857
+ data
858
+ end
859
+
860
+ # Remove a role
861
+ # Remove a role for this object from users/groups.
862
+ # @param ostree_ostree_repository_href [String]
863
+ # @param nested_role [NestedRole]
864
+ # @param [Hash] opts the optional parameters
865
+ # @return [Array<(NestedRoleResponse, Integer, Hash)>] NestedRoleResponse data, response status code and response headers
866
+ def remove_role_with_http_info(ostree_ostree_repository_href, nested_role, opts = {})
867
+ if @api_client.config.debugging
868
+ @api_client.config.logger.debug 'Calling API: RepositoriesOstreeApi.remove_role ...'
869
+ end
870
+ # verify the required parameter 'ostree_ostree_repository_href' is set
871
+ if @api_client.config.client_side_validation && ostree_ostree_repository_href.nil?
872
+ fail ArgumentError, "Missing the required parameter 'ostree_ostree_repository_href' when calling RepositoriesOstreeApi.remove_role"
873
+ end
874
+ # verify the required parameter 'nested_role' is set
875
+ if @api_client.config.client_side_validation && nested_role.nil?
876
+ fail ArgumentError, "Missing the required parameter 'nested_role' when calling RepositoriesOstreeApi.remove_role"
877
+ end
878
+ # resource path
879
+ local_var_path = '{ostree_ostree_repository_href}remove_role/'.sub('{' + 'ostree_ostree_repository_href' + '}', CGI.escape(ostree_ostree_repository_href.to_s).gsub('%2F', '/'))
880
+
881
+ # query parameters
882
+ query_params = opts[:query_params] || {}
883
+
884
+ # header parameters
885
+ header_params = opts[:header_params] || {}
886
+ # HTTP header 'Accept' (if needed)
887
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
888
+ # HTTP header 'Content-Type'
889
+ header_params['Content-Type'] = @api_client.select_header_content_type(['application/json', 'application/x-www-form-urlencoded', 'multipart/form-data'])
890
+
891
+ # form parameters
892
+ form_params = opts[:form_params] || {}
893
+
894
+ # http body (model)
895
+ post_body = opts[:body] || @api_client.object_to_http_body(nested_role)
896
+
897
+ # return_type
898
+ return_type = opts[:return_type] || 'NestedRoleResponse'
899
+
900
+ # auth_names
901
+ auth_names = opts[:auth_names] || ['basicAuth']
902
+
903
+ new_options = opts.merge(
904
+ :header_params => header_params,
905
+ :query_params => query_params,
906
+ :form_params => form_params,
907
+ :body => post_body,
908
+ :auth_names => auth_names,
909
+ :return_type => return_type
910
+ )
911
+
912
+ data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
913
+ if @api_client.config.debugging
914
+ @api_client.config.logger.debug "API called: RepositoriesOstreeApi#remove_role\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
915
+ end
916
+ return data, status_code, headers
917
+ end
918
+
643
919
  # Set a label
644
920
  # Set a single pulp_label on the object to a specific value or null.
645
921
  # @param ostree_ostree_repository_href [String]
@@ -0,0 +1,213 @@
1
+ =begin
2
+ #Pulp 3 API
3
+
4
+ #Fetch, Upload, Organize, and Distribute Software Packages
5
+
6
+ The version of the OpenAPI document: v3
7
+ Contact: pulp-list@redhat.com
8
+ Generated by: https://openapi-generator.tech
9
+ OpenAPI Generator version: 4.3.1
10
+
11
+ =end
12
+
13
+ require 'date'
14
+
15
+ module PulpOstreeClient
16
+ class MyPermissionsResponse
17
+ attr_accessor :permissions
18
+
19
+ # Attribute mapping from ruby-style variable name to JSON key.
20
+ def self.attribute_map
21
+ {
22
+ :'permissions' => :'permissions'
23
+ }
24
+ end
25
+
26
+ # Attribute type mapping.
27
+ def self.openapi_types
28
+ {
29
+ :'permissions' => :'Array<String>'
30
+ }
31
+ end
32
+
33
+ # List of attributes with nullable: true
34
+ def self.openapi_nullable
35
+ Set.new([
36
+ ])
37
+ end
38
+
39
+ # Initializes the object
40
+ # @param [Hash] attributes Model attributes in the form of hash
41
+ def initialize(attributes = {})
42
+ if (!attributes.is_a?(Hash))
43
+ fail ArgumentError, "The input argument (attributes) must be a hash in `PulpOstreeClient::MyPermissionsResponse` initialize method"
44
+ end
45
+
46
+ # check to see if the attribute exists and convert string to symbol for hash key
47
+ attributes = attributes.each_with_object({}) { |(k, v), h|
48
+ if (!self.class.attribute_map.key?(k.to_sym))
49
+ fail ArgumentError, "`#{k}` is not a valid attribute in `PulpOstreeClient::MyPermissionsResponse`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
50
+ end
51
+ h[k.to_sym] = v
52
+ }
53
+
54
+ if attributes.key?(:'permissions')
55
+ if (value = attributes[:'permissions']).is_a?(Array)
56
+ self.permissions = value
57
+ end
58
+ end
59
+ end
60
+
61
+ # Show invalid properties with the reasons. Usually used together with valid?
62
+ # @return Array for valid properties with the reasons
63
+ def list_invalid_properties
64
+ invalid_properties = Array.new
65
+ if @permissions.nil?
66
+ invalid_properties.push('invalid value for "permissions", permissions cannot be nil.')
67
+ end
68
+
69
+ invalid_properties
70
+ end
71
+
72
+ # Check to see if the all the properties in the model are valid
73
+ # @return true if the model is valid
74
+ def valid?
75
+ return false if @permissions.nil?
76
+ true
77
+ end
78
+
79
+ # Checks equality by comparing each attribute.
80
+ # @param [Object] Object to be compared
81
+ def ==(o)
82
+ return true if self.equal?(o)
83
+ self.class == o.class &&
84
+ permissions == o.permissions
85
+ end
86
+
87
+ # @see the `==` method
88
+ # @param [Object] Object to be compared
89
+ def eql?(o)
90
+ self == o
91
+ end
92
+
93
+ # Calculates hash code according to all attributes.
94
+ # @return [Integer] Hash code
95
+ def hash
96
+ [permissions].hash
97
+ end
98
+
99
+ # Builds the object from hash
100
+ # @param [Hash] attributes Model attributes in the form of hash
101
+ # @return [Object] Returns the model itself
102
+ def self.build_from_hash(attributes)
103
+ new.build_from_hash(attributes)
104
+ end
105
+
106
+ # Builds the object from hash
107
+ # @param [Hash] attributes Model attributes in the form of hash
108
+ # @return [Object] Returns the model itself
109
+ def build_from_hash(attributes)
110
+ return nil unless attributes.is_a?(Hash)
111
+ self.class.openapi_types.each_pair do |key, type|
112
+ if type =~ /\AArray<(.*)>/i
113
+ # check to ensure the input is an array given that the attribute
114
+ # is documented as an array but the input is not
115
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
116
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
117
+ end
118
+ elsif !attributes[self.class.attribute_map[key]].nil?
119
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
120
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
121
+ end
122
+
123
+ self
124
+ end
125
+
126
+ # Deserializes the data based on type
127
+ # @param string type Data type
128
+ # @param string value Value to be deserialized
129
+ # @return [Object] Deserialized data
130
+ def _deserialize(type, value)
131
+ case type.to_sym
132
+ when :DateTime
133
+ DateTime.parse(value)
134
+ when :Date
135
+ Date.parse(value)
136
+ when :String
137
+ value.to_s
138
+ when :Integer
139
+ value.to_i
140
+ when :Float
141
+ value.to_f
142
+ when :Boolean
143
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
144
+ true
145
+ else
146
+ false
147
+ end
148
+ when :Object
149
+ # generic object (usually a Hash), return directly
150
+ value
151
+ when /\AArray<(?<inner_type>.+)>\z/
152
+ inner_type = Regexp.last_match[:inner_type]
153
+ value.map { |v| _deserialize(inner_type, v) }
154
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
155
+ k_type = Regexp.last_match[:k_type]
156
+ v_type = Regexp.last_match[:v_type]
157
+ {}.tap do |hash|
158
+ value.each do |k, v|
159
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
160
+ end
161
+ end
162
+ else # model
163
+ PulpOstreeClient.const_get(type).build_from_hash(value)
164
+ end
165
+ end
166
+
167
+ # Returns the string representation of the object
168
+ # @return [String] String presentation of the object
169
+ def to_s
170
+ to_hash.to_s
171
+ end
172
+
173
+ # to_body is an alias to to_hash (backward compatibility)
174
+ # @return [Hash] Returns the object in the form of hash
175
+ def to_body
176
+ to_hash
177
+ end
178
+
179
+ # Returns the object in the form of hash
180
+ # @return [Hash] Returns the object in the form of hash
181
+ def to_hash
182
+ hash = {}
183
+ self.class.attribute_map.each_pair do |attr, param|
184
+ value = self.send(attr)
185
+ if value.nil?
186
+ is_nullable = self.class.openapi_nullable.include?(attr)
187
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
188
+ end
189
+
190
+ hash[param] = _to_hash(value)
191
+ end
192
+ hash
193
+ end
194
+
195
+ # Outputs non-array value in the form of hash
196
+ # For object, use to_hash. Otherwise, just return the value
197
+ # @param [Object] value Any valid value
198
+ # @return [Hash] Returns the value in the form of hash
199
+ def _to_hash(value)
200
+ if value.is_a?(Array)
201
+ value.compact.map { |v| _to_hash(v) }
202
+ elsif value.is_a?(Hash)
203
+ {}.tap do |hash|
204
+ value.each { |k, v| hash[k] = _to_hash(v) }
205
+ end
206
+ elsif value.respond_to? :to_hash
207
+ value.to_hash
208
+ else
209
+ value
210
+ end
211
+ end
212
+ end
213
+ end