Class: VaucharAPI::Team
- Defined in:
- lib/vauchar_api/resources/team.rb
Overview
Examples
Create
new_team = VaucharAPI::Team.new(name: "test by max", email: "[email protected]", password: "123456")
new_team.save
Read
team = VaucharAPI::Team.find("DA2C253VYBM")
teams = VaucharAPI::Team.all
Delete
team = VaucharAPI::Team.find("DA2C253VYBM")
team.destroy
Redeem
team = VaucharAPI::Team.find("DA2C253VYBM")
data = { user_id: "2", password: "123456" }
team.redeem(data, params: {voucher_id: "vcr-15524967755c89388793c97"})
Instance Method Summary collapse
Methods inherited from Base
#accepts_attributes, #encode, init_prefix, init_prefix_explicit, password, user
Instance Method Details
#redeem(*args) ⇒ Object
22 23 24 25 26 27 |
# File 'lib/vauchar_api/resources/team.rb', line 22 def redeem(*args) = args[0] params = .merge(args[1][:params]) if args[1] && args[1][:params] resource = post("redeem/vouchers/#{params[:voucher_id]}", {}, .to_json) self.class.format.decode(resource.body) end |