class MyJohnDeereApi::Request::Update::Base
Attributes
attributes[R]
client[R]
item[R]
response[R]
Public Class Methods
new(client, item, attributes)
click to toggle source
Accepts a valid oAuth AccessToken, the item to be updated, and a hash of attributes.
category/type/subtype must be a recognized combination as defined above.
# File lib/my_john_deere_api/request/update/base.rb, line 15 def initialize(client, item, attributes) @client = client @item = item @attributes = item.attributes.merge(attributes) process_attributes end
Public Instance Methods
object()
click to toggle source
Object, same as item for updates
# File lib/my_john_deere_api/request/update/base.rb, line 35 def object @object ||= item end
request()
click to toggle source
Make the request, if the instance is valid
# File lib/my_john_deere_api/request/update/base.rb, line 26 def request validate! @response = client.put(resource, request_body.to_json) end
Private Instance Methods
process_attributes()
click to toggle source
Convert inputs into working attributes. This allows us to auto-create some attributes from others, or set defaults, on a class-by-class basis. See Request::Create::AssetLocation
for an example.
# File lib/my_john_deere_api/request/update/base.rb, line 46 def process_attributes end