Module: Jamm

Defined in:
lib/jamm.rb,
lib/jamm/oauth.rb,
lib/jamm/client.rb,
lib/jamm/errors.rb,
lib/jamm/openapi.rb,
lib/jamm/payment.rb,
lib/jamm/version.rb,
lib/jamm/webhook.rb,
lib/jamm/customer.rb,
lib/jamm/deprecation.rb,
lib/jamm/healthcheck.rb

Overview

Jamm Ruby SDK

Defined Under Namespace

Modules: Client, Customer, Deprecation, Healthcheck, Mode, OAuth, OpenAPI, Payment, Webhook Classes: ApiError, ErrorType, InvalidSignatureError, JammError, OAuthError

Constant Summary collapse

VERSION =
'2.2.0'

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.apiObject

Returns the value of attribute api.



41
42
43
# File 'lib/jamm.rb', line 41

def api
  @api
end

.api_baseObject

Returns the value of attribute api_base.



41
42
43
# File 'lib/jamm.rb', line 41

def api_base
  @api_base
end

.api_versionObject

Returns the value of attribute api_version.



41
42
43
# File 'lib/jamm.rb', line 41

def api_version
  @api_version
end

.client_idObject

Returns the value of attribute client_id.



41
42
43
# File 'lib/jamm.rb', line 41

def client_id
  @client_id
end

.client_secretObject

Returns the value of attribute client_secret.



41
42
43
# File 'lib/jamm.rb', line 41

def client_secret
  @client_secret
end

.connect_baseObject

Returns the value of attribute connect_base.



41
42
43
# File 'lib/jamm.rb', line 41

def connect_base
  @connect_base
end

.environmentObject

Returns the value of attribute environment.



41
42
43
# File 'lib/jamm.rb', line 41

def environment
  @environment
end

.max_retryObject

Returns the value of attribute max_retry.



41
42
43
# File 'lib/jamm.rb', line 41

def max_retry
  @max_retry
end

.modeObject

Returns the value of attribute mode.



41
42
43
# File 'lib/jamm.rb', line 41

def mode
  @mode
end

.oauth_baseObject

Returns the value of attribute oauth_base.



41
42
43
# File 'lib/jamm.rb', line 41

def oauth_base
  @oauth_base
end

.open_timeoutObject

Returns the value of attribute open_timeout.



41
42
43
# File 'lib/jamm.rb', line 41

def open_timeout
  @open_timeout
end

.openapiObject

Returns the value of attribute openapi.



41
42
43
# File 'lib/jamm.rb', line 41

def openapi
  @openapi
end

.read_timeoutObject

Returns the value of attribute read_timeout.



41
42
43
# File 'lib/jamm.rb', line 41

def read_timeout
  @read_timeout
end

.retry_initial_delayObject

Returns the value of attribute retry_initial_delay.



41
42
43
# File 'lib/jamm.rb', line 41

def retry_initial_delay
  @retry_initial_delay
end

.retry_max_delayObject

Returns the value of attribute retry_max_delay.



41
42
43
# File 'lib/jamm.rb', line 41

def retry_max_delay
  @retry_max_delay
end

Class Method Details

.configure(client_id:, client_secret:, env:, platform: false) ⇒ Object

Configure SDK with Client ID and Secret. Optionally enable ‘platform` for platformers to call Jamm API on behalf of their merchant.



47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
# File 'lib/jamm.rb', line 47

def self.configure(client_id:, client_secret:, env:, platform: false)
  Jamm.client_id = client_id
  Jamm.client_secret = client_secret

  Jamm.mode = platform ? Jamm::Mode::PLATFORM : Jamm::Mode::MERCHANT

  case env
  when 'prd', 'prod', 'production'
    self.oauth_base = Jamm.mode == Jamm::Mode::PLATFORM ? 'https://platform-identity.jamm-pay.jp' : 'https://merchant-identity.jamm-pay.jp'

    self.environment = 'production'
    self.openapi = Jamm::OpenAPI::ApiClient.new
    openapi.config.host = 'api.jamm-pay.jp'

  when 'local'
    self.oauth_base = Jamm.mode == Jamm::Mode::PLATFORM ? 'https://platform-identity.develop.jamm-pay.jp' : 'https://merchant-identity.develop.jamm-pay.jp'

    self.environment = 'local'
    self.openapi = Jamm::OpenAPI::ApiClient.new
    openapi.config.host = 'api.jamm.test'
    openapi.config.verify_ssl = false
    openapi.config.verify_ssl_host = false
  else
    self.oauth_base = Jamm.mode == Jamm::Mode::PLATFORM ? "https://platform-identity.#{env}.jamm-pay.jp" : "https://merchant-identity.#{env}.jamm-pay.jp"

    self.environment = env
    self.openapi = Jamm::OpenAPI::ApiClient.new
    openapi.config.host = "api.#{env}.jamm-pay.jp"
  end

  openapi.config.scheme = 'https'
end

.execute_request(option) ⇒ Object



80
81
82
# File 'lib/jamm.rb', line 80

def self.execute_request(option)
  RestClient::Request.execute(option)
end