Class: MethodRuby::Resources::Entities::Attributes
- Inherits:
-
Object
- Object
- MethodRuby::Resources::Entities::Attributes
- Defined in:
- lib/method_ruby/resources/entities/attributes.rb
Overview
Attribute data for entities
Instance Method Summary collapse
-
#create(entity_id, method_version:, attributes: nil, idempotency_key: nil, request_options: {}) ⇒ MethodRuby::Models::Entities::AttributeCreateResponse
Some parameter documentations has been truncated, see Models::Entities::AttributeCreateParams for more details.
-
#initialize(client:) ⇒ Attributes
constructor
private
A new instance of Attributes.
-
#list(entity_id, method_version:, from_date: nil, page: nil, page_cursor: nil, page_limit: nil, to_date: nil, request_options: {}) ⇒ MethodRuby::Models::Entities::AttributeListResponse
Some parameter documentations has been truncated, see Models::Entities::AttributeListParams for more details.
-
#retrieve(attr_id, entity_id:, method_version:, request_options: {}) ⇒ MethodRuby::Models::Entities::AttributeRetrieveResponse
Some parameter documentations has been truncated, see Models::Entities::AttributeRetrieveParams for more details.
Constructor Details
#initialize(client:) ⇒ Attributes
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns a new instance of Attributes.
120 121 122 |
# File 'lib/method_ruby/resources/entities/attributes.rb', line 120 def initialize(client:) @client = client end |
Instance Method Details
#create(entity_id, method_version:, attributes: nil, idempotency_key: nil, request_options: {}) ⇒ MethodRuby::Models::Entities::AttributeCreateResponse
Some parameter documentations has been truncated, see Models::Entities::AttributeCreateParams for more details.
Creates a new attribute retrieval for the specified entity.
28 29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/method_ruby/resources/entities/attributes.rb', line 28 def create(entity_id, params) parsed, = MethodRuby::Entities::AttributeCreateParams.dump_request(params) header_params = {method_version: "method-version", idempotency_key: "idempotency-key"} @client.request( method: :post, path: ["entities/%1$s/attributes", entity_id], headers: parsed.slice(*header_params.keys).transform_keys(header_params), body: parsed.except(*header_params.keys), model: MethodRuby::Models::Entities::AttributeCreateResponse, security: {secret_key: true}, options: ) end |
#list(entity_id, method_version:, from_date: nil, page: nil, page_cursor: nil, page_limit: nil, to_date: nil, request_options: {}) ⇒ MethodRuby::Models::Entities::AttributeListResponse
Some parameter documentations has been truncated, see Models::Entities::AttributeListParams for more details.
Returns a list of attributes for the specified entity.
102 103 104 105 106 107 108 109 110 111 112 113 114 115 |
# File 'lib/method_ruby/resources/entities/attributes.rb', line 102 def list(entity_id, params) query_params = [:from_date, :page, :page_cursor, :page_limit, :to_date] parsed, = MethodRuby::Entities::AttributeListParams.dump_request(params) query = MethodRuby::Internal::Util.encode_query_params(parsed.slice(*query_params)) @client.request( method: :get, path: ["entities/%1$s/attributes", entity_id], query: query, headers: parsed.except(*query_params).transform_keys(method_version: "method-version"), model: MethodRuby::Models::Entities::AttributeListResponse, security: {secret_key: true}, options: ) end |
#retrieve(attr_id, entity_id:, method_version:, request_options: {}) ⇒ MethodRuby::Models::Entities::AttributeRetrieveResponse
Some parameter documentations has been truncated, see Models::Entities::AttributeRetrieveParams for more details.
Returns a single entity attribute by its identifier.
60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 |
# File 'lib/method_ruby/resources/entities/attributes.rb', line 60 def retrieve(attr_id, params) parsed, = MethodRuby::Entities::AttributeRetrieveParams.dump_request(params) entity_id = parsed.delete(:entity_id) do raise ArgumentError.new("missing required path argument #{_1}") end @client.request( method: :get, path: ["entities/%1$s/attributes/%2$s", entity_id, attr_id], headers: parsed.transform_keys(method_version: "method-version"), model: MethodRuby::Models::Entities::AttributeRetrieveResponse, security: {secret_key: true}, options: ) end |