Class: Iyzipay::Model::V2::Subscription

Inherits:
IyzipayResourceV2 show all
Defined in:
lib/iyzipay/model/v2/subscription.rb

Constant Summary collapse

RESOURCE =
'/v2/subscription'

Constants inherited from IyzipayResourceV2

IyzipayResourceV2::AUTHORIZATION_HEADER_STRING

Constants inherited from IyzipayResource

IyzipayResource::AUTHORIZATION_HEADER_NAME, IyzipayResource::AUTHORIZATION_HEADER_STRING, IyzipayResource::RANDOM_CHARS, IyzipayResource::RANDOM_HEADER_NAME, IyzipayResource::RANDOM_STRING_SIZE

Instance Method Summary collapse

Methods inherited from IyzipayResourceV2

#calculate_hash, #get_http_header, #prepare_authorization_string

Methods inherited from IyzipayResource

#calculate_hash, #format_header_string, #get_http_header, #get_plain_http_header, #json_decode, #prepare_authorization_string, #random_string, #to_pki_string

Instance Method Details

#activate(request, options) ⇒ Object



6
7
8
9
10
11
# File 'lib/iyzipay/model/v2/subscription.rb', line 6

def activate(request, options)
  path = path_for_action(request[:subscriptionReferenceCode], 'subscriptions/activate')
  data = request.to_json
  header = get_http_header(options, path, data)
  HttpClient.post_even_on_error(base_url(options, path), header, data)
end

#cancel(request, options) ⇒ Object



27
28
29
30
31
32
# File 'lib/iyzipay/model/v2/subscription.rb', line 27

def cancel(request, options)
  path = path_for_action('subscriptions', request[:subscriptionReferenceCode], 'cancel')
  data = request.to_json
  header = get_http_header(options, path, data)
  HttpClient.post_even_on_error(base_url(options, path), header, data)
end

#details(request, options) ⇒ Object



34
35
36
37
38
39
# File 'lib/iyzipay/model/v2/subscription.rb', line 34

def details(request, options)
  path = path_for_action('subscriptions', request[:subscriptionReferenceCode])
  data = request.to_json
  header = get_http_header(options, path, data)
  HttpClient.post_even_on_error(base_url(options, path), header, data)
end

#retry(request, options) ⇒ Object



13
14
15
16
17
18
# File 'lib/iyzipay/model/v2/subscription.rb', line 13

def retry(request, options)
  path = path_for_action('operation/retry')
  data = request.to_json
  header = get_http_header(options, path,  data)
  HttpClient.post_even_on_error(base_url(options, path), header, data)
end

#search(request, options) ⇒ Object



41
42
43
44
45
46
# File 'lib/iyzipay/model/v2/subscription.rb', line 41

def search(request, options)
  data = request.to_json
  path = path_for_action('subscriptions')
  header = get_http_header(options, path, data)
  HttpClient.get_even_on_error(base_url(options, RESOURCE), header)
end

#upgrade(request, options) ⇒ Object



20
21
22
23
24
25
# File 'lib/iyzipay/model/v2/subscription.rb', line 20

def upgrade(request, options)
  path = path_for_action('subscriptions', request[:subscriptionReferenceCode], 'upgrade')
  data = request.to_json
  header = get_http_header(options, path, data)
  HttpClient.post_even_on_error(base_url(options, path), header, data)
end