Class: Iyzipay::Model::V2::Plan

Inherits:
IyzipayResourceV2 show all
Defined in:
lib/iyzipay/model/v2/plan.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

#create(request, options) ⇒ Object



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

def create(request, options)
  path = path_for_action('products', request[:productReferenceCode], 'pricing-plans')
  data = request.to_json
  header = get_http_header(options, path, data)
  HttpClient.post_even_on_error(base_url(options, path), header, data)
end

#update(request, options) ⇒ Object



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

def update(request, options)
  path = path_for_action('pricing-plans', request[:pricingPlanReferenceCode])
  data = request.to_json
  header = get_http_header(options, path, data)
  HttpClient.post_even_on_error(base_url(options, path), header, data)
end