Class: RakutenApi::Base::Client

Inherits:
Object
  • Object
show all
Defined in:
lib/rakuten_api/base/client.rb

Instance Method Summary collapse

Constructor Details

#initialize(application_id = nil, affiliate_id = nil) {|@params| ... } ⇒ Client

Returns a new instance of Client.

Yields:



5
6
7
8
# File 'lib/rakuten_api/base/client.rb', line 5

def initialize(application_id = nil, affiliate_id = nil)
  init_params(application_id, affiliate_id)
  yield @params if block_given?
end

Instance Method Details

#add_param(name, value) ⇒ Object



30
31
32
# File 'lib/rakuten_api/base/client.rb', line 30

def add_param(name, value)
  @params[name] = value
end

#connectionObject



22
23
24
# File 'lib/rakuten_api/base/client.rb', line 22

def connection
  @connection ||= new_connection
end

#getObject



14
15
16
# File 'lib/rakuten_api/base/client.rb', line 14

def get
  raise "not implement"
end

#init_params(application_id, affiliate_id) ⇒ Object



10
11
12
# File 'lib/rakuten_api/base/client.rb', line 10

def init_params(application_id, affiliate_id)
  raise "not implement"
end

#new_connectionObject



34
35
36
37
38
39
# File 'lib/rakuten_api/base/client.rb', line 34

def new_connection
  ::Faraday.new(url: ::RakutenApi::APPLICATION_END_POINT) do |faraday|
    faraday.request  :url_encoded
    faraday.adapter  Faraday.default_adapter
  end
end

#paramsObject



26
27
28
# File 'lib/rakuten_api/base/client.rb', line 26

def params
  @params.to_hash
end

#requestObject



18
19
20
# File 'lib/rakuten_api/base/client.rb', line 18

def request
  raise "not implement"
end