Class: Vng::Asset
Overview
Provides methods to interact with Vonigo assets.
Constant Summary collapse
- PATH =
'/api/v1/data/Assets/'
Instance Attribute Summary collapse
-
#id ⇒ Object
readonly
Returns the value of attribute id.
Class Method Summary collapse
Instance Method Summary collapse
- #destroy ⇒ Object
-
#initialize(id:) ⇒ Asset
constructor
A new instance of Asset.
Constructor Details
#initialize(id:) ⇒ Asset
Returns a new instance of Asset.
10 11 12 |
# File 'lib/vng/asset.rb', line 10 def initialize(id:) @id = id end |
Instance Attribute Details
#id ⇒ Object (readonly)
Returns the value of attribute id.
8 9 10 |
# File 'lib/vng/asset.rb', line 8 def id @id end |
Class Method Details
.create(name:, weight:, breed_option_id:, client_id:) ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/vng/asset.rb', line 14 def self.create(name:, weight:, breed_option_id:, client_id:) body = { method: '3', clientID: client_id, Fields: [ { fieldID: 1013, fieldValue: name }, { fieldID: 1017, fieldValue: weight }, { fieldID: 1014, optionID: breed_option_id }, ], } data = request path: PATH, body: body # curl = 'curl'.tap do |curl| # curl << ' -X POST' # request.each_header{|k, v| curl << %Q{ -H "#{k}: #{v}"}} # curl << %Q{ -d '#{request.body}'} if request.body # curl << %Q{ "#{uri.to_s}"} # end # puts curl new id: data['Asset']['objectID'] end |
Instance Method Details
#destroy ⇒ Object
38 39 40 41 42 43 44 45 |
# File 'lib/vng/asset.rb', line 38 def destroy body = { method: '4', objectID: id, } data = self.class.request path: PATH, body: body end |