Module: Shushu::RCode

Extended by:
RCode
Included in:
RCode
Defined in:
lib/models/r_code.rb

Instance Method Summary collapse

Instance Method Details

#create(args) ⇒ Object



5
6
7
8
9
10
11
12
13
14
15
16
# File 'lib/models/r_code.rb', line 5

def create(args)
  if args[:slug].nil?
    Shushu.handle_req do
      RestClient.post(rate_codes_url, args, Shushu.headers)
    end
  else
    Shushu.handle_req do
      url = [rate_codes_url, args.delete(:slug)].join("/")
      RestClient.put(url, args, Shushu.headers)
    end
  end
end

#rate_codes_urlObject



18
19
20
# File 'lib/models/r_code.rb', line 18

def rate_codes_url
  [Shushu.url, "/rate_codes"].join
end