Class: ChargeBee::Request
- Inherits:
-
Object
- Object
- ChargeBee::Request
- Defined in:
- lib/chargebee/request.rb
Class Method Summary collapse
- .send(method, url, params = {}, env = nil, headers = {}) ⇒ Object
- .send_list_request(method, url, params = {}, env = nil, headers = {}) ⇒ Object
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 = Rest.request(method, url, env, ser_params||={}, headers) if resp.has_key?(:list) ListResult.new(resp[:list], resp[:next_offset]) else Result.new(resp) 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 |