Class: Openpix::RubySdk::Resources::Subscription

Inherits:
Resource
  • Object
show all
Defined in:
lib/openpix/ruby_sdk/resources/subscription.rb

Overview

Make API operations on Subscription resource

Constant Summary collapse

ATTRS =
%w[
  value
  dayGenerateCharge
  customer
  chargeType
].freeze

Instance Method Summary collapse

Methods inherited from Resource

#find, #find!, #initialize, #save, #save!, #to_collection_resource

Constructor Details

This class inherits a constructor from Openpix::RubySdk::Resources::Resource

Instance Method Details

#create_attributesObject



26
27
28
# File 'lib/openpix/ruby_sdk/resources/subscription.rb', line 26

def create_attributes
  ATTRS
end

#destroy(id:) ⇒ Object



77
78
79
80
81
82
# File 'lib/openpix/ruby_sdk/resources/subscription.rb', line 77

def destroy(id:)
  raise(
    ActionNotImplementedError,
    'subscription does not implement DELETE action'
  )
end

#destroy!(id:) ⇒ Object



84
85
86
87
88
89
# File 'lib/openpix/ruby_sdk/resources/subscription.rb', line 84

def destroy!(id:)
  raise(
    ActionNotImplementedError,
    'subscription does not implement DELETE action'
  )
end

#fetch(skip: nil, limit: nil, extra_headers: {}) ⇒ Object

rubocop:disable Lint/UnusedMethodArgument



49
50
51
52
53
54
# File 'lib/openpix/ruby_sdk/resources/subscription.rb', line 49

def fetch(skip: nil, limit: nil, extra_headers: {})
  raise(
    ActionNotImplementedError,
    'subscription does not implement GET index action'
  )
end

#fetch!(skip: nil, limit: nil, extra_headers: {}) ⇒ Object



56
57
58
59
60
61
# File 'lib/openpix/ruby_sdk/resources/subscription.rb', line 56

def fetch!(skip: nil, limit: nil, extra_headers: {})
  raise(
    ActionNotImplementedError,
    'subscription does not implement GET index action'
  )
end

#fetch_next_page!(extra_headers: {}) ⇒ Object



63
64
65
66
67
68
# File 'lib/openpix/ruby_sdk/resources/subscription.rb', line 63

def fetch_next_page!(extra_headers: {})
  raise(
    ActionNotImplementedError,
    'subscription does not implement GET index action'
  )
end

#fetch_previous_page!(extra_headers: {}) ⇒ Object



70
71
72
73
74
75
# File 'lib/openpix/ruby_sdk/resources/subscription.rb', line 70

def fetch_previous_page!(extra_headers: {})
  raise(
    ActionNotImplementedError,
    'subscription does not implement GET index action'
  )
end

#init_body(params: {}, rest: {}) ⇒ Object

Parameters:

  • params (Hash{String => String, Number, Hash{String, Number}, Array<Hash{String, String}>}) (defaults to: {})

    the attributes for creating a Charge

  • rest (Hash) (defaults to: {})

    more attributes to be merged at the body, use this only for unsupported fields



22
23
24
# File 'lib/openpix/ruby_sdk/resources/subscription.rb', line 22

def init_body(params: {}, rest: {})
  super(base_attrs: ATTRS, params: params, rest: rest)
end

#to_bodyObject



38
39
40
41
42
43
44
45
46
# File 'lib/openpix/ruby_sdk/resources/subscription.rb', line 38

def to_body
  body = super

  return body if body['customer'].nil? || body['customer'].empty?

  body['customer'] = Openpix::RubySdk::ApiBodyFormatter.remove_empty_values(body['customer'])

  body
end

#to_single_resourceObject



34
35
36
# File 'lib/openpix/ruby_sdk/resources/subscription.rb', line 34

def to_single_resource
  'subscription'
end

#to_urlObject



30
31
32
# File 'lib/openpix/ruby_sdk/resources/subscription.rb', line 30

def to_url
  'subscriptions'
end