class MyJohnDeereApi::Request::Create::Base
Attributes
attributes[R]
client[R]
response[R]
Public Class Methods
new(client, attributes)
click to toggle source
Accepts a valid oAuth AccessToken, and a hash of attributes.
# File lib/my_john_deere_api/request/create/base.rb, line 12 def initialize(client, attributes) @client = client @attributes = attributes process_attributes end
Public Instance Methods
object()
click to toggle source
Object created by request
# File lib/my_john_deere_api/request/create/base.rb, line 31 def object return @object if defined?(@object) request unless response @object = individual_class.new(client, record_id).object end
request()
click to toggle source
Make the request, if the instance is valid
# File lib/my_john_deere_api/request/create/base.rb, line 22 def request validate! @response = client.post(resource, request_body) 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/create/base.rb, line 46 def process_attributes end