Class: ChargeBee::Request

Inherits:
Object
  • Object
show all
Defined in:
lib/chargebee/request.rb

Class Method Summary collapse

Class Method Details

.send(method, url, params = {}, env = nil, headers = {}) ⇒ Object



15
16
17
18
19
20
21
22
23
24
# File 'lib/chargebee/request.rb', line 15

def self.send(method, url, params={}, env=nil, headers={})
  env ||= ChargeBee.default_env
  ser_params = Util.serialize(params)
  resp, rheaders = Rest.request(method, url, env, ser_params||={}, headers)
  if resp.has_key?(:list)
    ListResult.new(resp[:list], resp[:next_offset], rheaders) 
  else 
    Result.new(resp, rheaders)
  end
end

.send_list_request(method, url, params = {}, env = nil, headers = {}) ⇒ Object



4
5
6
7
8
9
10
11
12
13
# File 'lib/chargebee/request.rb', line 4

def self.send_list_request(method, url, params={}, env=nil, headers={})
  serialized = {}
  params.each do |k, v|
    if(v.kind_of? Array)
      v = v.to_json
    end
    serialized["#{k}"] = v
  end 
  self.send(method, url, serialized, env, headers) 
end