Class: ChartMogul::CustomerInvoices
Constant Summary
Constants inherited
from APIResource
APIResource::BACKOFF_FACTOR, APIResource::INTERVAL, APIResource::INTERVAL_RANDOMNESS, APIResource::MAX_INTERVAL, APIResource::RETRY_EXCEPTIONS, APIResource::RETRY_STATUSES, APIResource::THREAD_CONNECTION_KEY
Class Method Summary
collapse
Instance Method Summary
collapse
included
included
#custom!, #custom_without_assign!, included
included
Methods inherited from APIResource
build_connection, connection, custom_with_query_params!, #custom_with_query_params!, extract_query_params, #extract_query_params, handle_other_error, handle_request_error, handling_errors, immutable_keys, #path_with_query_params, query_params, set_immutable_keys, set_resource_name, set_resource_path, set_resource_root_key, writeable_query_param
Methods inherited from Object
#allowed_for_write?, #assign_all_attributes, #assign_writeable_attributes, attributes, define_private_writer, define_reader, define_writer, #initialize, #instance_attributes, new_from_json, readonly_attr, #serialize_for_write, #serialized_value_for_attr, writeable_attr, writeable_attributes
Class Method Details
.all(customer_uuid, options = {}) ⇒ Object
49
50
51
|
# File 'lib/chartmogul/customer_invoices.rb', line 49
def self.all(customer_uuid, options = {})
super(options.merge(customer_uuid: customer_uuid))
end
|
.create!(attributes = {}) ⇒ Object
33
34
35
36
37
38
39
|
# File 'lib/chartmogul/customer_invoices.rb', line 33
def self.create!(attributes = {})
resource = new(attributes)
query_params_data = attributes.select { |k, _| query_params.include?(k.to_sym) }
body_data = resource.serialize_for_write.merge(query_params_data)
resource.custom_with_query_params!(:post, body_data)
end
|
.destroy_all!(data_source_uuid, customer_uuid) ⇒ Object
57
58
59
60
61
62
63
|
# File 'lib/chartmogul/customer_invoices.rb', line 57
def self.destroy_all!(data_source_uuid, customer_uuid)
path = ChartMogul::ResourcePath.new("v1/data_sources/:data_source_uuid/customers/:customer_uuid/invoices")
handling_errors do
connection.delete(path.apply(data_source_uuid: data_source_uuid, customer_uuid: customer_uuid))
end
true
end
|
Instance Method Details
26
27
28
29
30
31
|
# File 'lib/chartmogul/customer_invoices.rb', line 26
def create!
query_params_data = instance_attributes.select { |k, _| self.class.query_params.include?(k.to_sym) }
body_data = serialize_for_write.merge(query_params_data)
custom_with_query_params!(:post, body_data)
end
|
#next(options = {}) ⇒ Object
53
54
55
|
# File 'lib/chartmogul/customer_invoices.rb', line 53
def next(options = {})
CustomerInvoices.all(customer_uuid, options.merge(cursor: cursor))
end
|
#serialize_invoices ⇒ Object
22
23
24
|
# File 'lib/chartmogul/customer_invoices.rb', line 22
def serialize_invoices
map(&:serialize_for_write)
end
|
#update!(attrs = {}) ⇒ Object
41
42
43
44
45
46
47
|
# File 'lib/chartmogul/customer_invoices.rb', line 41
def update!(attrs = {})
updated_attrs = instance_attributes.merge(attrs)
query_params_data = updated_attrs.select { |k, _| self.class.query_params.include?(k.to_sym) }
body_data = serialize_for_write.merge(query_params_data)
custom_with_query_params!(:put, body_data)
end
|