Class: Iyzipay::Model::Card

Inherits:
IyzipayResource show all
Defined in:
lib/iyzipay/model/card.rb

Constant Summary

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 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



5
6
7
8
# File 'lib/iyzipay/model/card.rb', line 5

def create(request = {}, options)
  pki_string = to_pki_string_create(request)
  HttpClient.post("#{options.base_url}/cardstorage/card", get_http_header(pki_string, options), request.to_json)
end

#delete(request = {}, options) ⇒ Object



10
11
12
13
# File 'lib/iyzipay/model/card.rb', line 10

def delete(request = {}, options)
  pki_string = to_pki_string_delete(request)
  HttpClient.delete("#{options.base_url}/cardstorage/card", get_http_header(pki_string, options), request.to_json)
end

#to_pki_string_create(request) ⇒ Object



15
16
17
18
19
20
21
22
23
24
# File 'lib/iyzipay/model/card.rb', line 15

def to_pki_string_create(request)
  PkiBuilder.new.
      append(:locale, request[:locale]).
      append(:conversationId, request[:conversationId]).
      append(:externalId, request[:externalId]).
      append(:email, request[:email]).
      append(:cardUserKey, request[:cardUserKey]).
      append(:card, CardInformation.to_pki_string(request[:card])).
      get_request_string
end

#to_pki_string_delete(request) ⇒ Object



26
27
28
29
30
31
32
33
# File 'lib/iyzipay/model/card.rb', line 26

def to_pki_string_delete(request)
  PkiBuilder.new.
      append(:locale, request[:locale]).
      append(:conversationId, request[:conversationId]).
      append(:cardUserKey, request[:cardUserKey]).
      append(:cardToken, request[:cardToken]).
      get_request_string
end