Module: Jamm

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

Overview

Jamm Ruby SDK

Defined Under Namespace

Modules: Charge, Client, Contract, Customer, Healthcheck, OAuth, OpenAPI, Webhook Classes: ApiError, InvalidSignatureError, JammError, OAuthError

Constant Summary collapse

VERSION =
'1.2.2'

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.apiObject

Returns the value of attribute api.



33
34
35
# File 'lib/jamm.rb', line 33

def api
  @api
end

.api_baseObject

Returns the value of attribute api_base.



33
34
35
# File 'lib/jamm.rb', line 33

def api_base
  @api_base
end

.api_versionObject

Returns the value of attribute api_version.



33
34
35
# File 'lib/jamm.rb', line 33

def api_version
  @api_version
end

.client_idObject

Returns the value of attribute client_id.



33
34
35
# File 'lib/jamm.rb', line 33

def client_id
  @client_id
end

.client_secretObject

Returns the value of attribute client_secret.



33
34
35
# File 'lib/jamm.rb', line 33

def client_secret
  @client_secret
end

.connect_baseObject

Returns the value of attribute connect_base.



33
34
35
# File 'lib/jamm.rb', line 33

def connect_base
  @connect_base
end

.envObject

Returns the value of attribute env.



33
34
35
# File 'lib/jamm.rb', line 33

def env
  @env
end

.max_retryObject

Returns the value of attribute max_retry.



33
34
35
# File 'lib/jamm.rb', line 33

def max_retry
  @max_retry
end

.oauth_baseObject

Returns the value of attribute oauth_base.



33
34
35
# File 'lib/jamm.rb', line 33

def oauth_base
  @oauth_base
end

.open_timeoutObject

Returns the value of attribute open_timeout.



33
34
35
# File 'lib/jamm.rb', line 33

def open_timeout
  @open_timeout
end

.openapiObject

Returns the value of attribute openapi.



33
34
35
# File 'lib/jamm.rb', line 33

def openapi
  @openapi
end

.read_timeoutObject

Returns the value of attribute read_timeout.



33
34
35
# File 'lib/jamm.rb', line 33

def read_timeout
  @read_timeout
end

.retry_initial_delayObject

Returns the value of attribute retry_initial_delay.



33
34
35
# File 'lib/jamm.rb', line 33

def retry_initial_delay
  @retry_initial_delay
end

.retry_max_delayObject

Returns the value of attribute retry_max_delay.



33
34
35
# File 'lib/jamm.rb', line 33

def retry_max_delay
  @retry_max_delay
end

Class Method Details

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



37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
# File 'lib/jamm.rb', line 37

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

  case env
  when 'prd', 'prod', 'production'
    self.oauth_base = 'https://merchant-identity.jamm-pay.jp'

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

  when 'local'
    self.oauth_base = 'https://merchant-identity.develop.jamm-pay.jp'

    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 = "https://merchant-identity.#{env}.jamm-pay.jp"

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

  openapi.config.scheme = 'https'
end

.execute_request(option) ⇒ Object



65
66
67
# File 'lib/jamm.rb', line 65

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