Class: MyJohnDeereApi::Request::Update::Base
- Inherits:
-
Object
- Object
- MyJohnDeereApi::Request::Update::Base
- Includes:
- Validators::Base
- Defined in:
- lib/my_john_deere_api/request/update/base.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#attributes ⇒ Object
readonly
Returns the value of attribute attributes.
-
#client ⇒ Object
readonly
Returns the value of attribute client.
-
#item ⇒ Object
readonly
Returns the value of attribute item.
-
#response ⇒ Object
readonly
Returns the value of attribute response.
Attributes included from Validators::Base
Instance Method Summary collapse
-
#accessor ⇒ Object
client accessor.
-
#initialize(client, item, attributes) ⇒ Base
constructor
Accepts a valid oAuth AccessToken, the item to be updated, and a hash of attributes.
-
#object ⇒ Object
Object, same as item for updates.
-
#request ⇒ Object
Make the request, if the instance is valid.
Methods included from Validators::Base
Constructor Details
#initialize(client, item, attributes) ⇒ Base
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.
15 16 17 18 19 20 21 |
# 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 |
Instance Attribute Details
#attributes ⇒ Object (readonly)
Returns the value of attribute attributes.
7 8 9 |
# File 'lib/my_john_deere_api/request/update/base.rb', line 7 def attributes @attributes end |
#client ⇒ Object (readonly)
Returns the value of attribute client.
7 8 9 |
# File 'lib/my_john_deere_api/request/update/base.rb', line 7 def client @client end |
#item ⇒ Object (readonly)
Returns the value of attribute item.
7 8 9 |
# File 'lib/my_john_deere_api/request/update/base.rb', line 7 def item @item end |
#response ⇒ Object (readonly)
Returns the value of attribute response.
7 8 9 |
# File 'lib/my_john_deere_api/request/update/base.rb', line 7 def response @response end |
Instance Method Details
#accessor ⇒ Object
client accessor
26 27 28 29 |
# File 'lib/my_john_deere_api/request/update/base.rb', line 26 def accessor return @accessor if defined?(@accessor) @accessor = client&.accessor end |
#object ⇒ Object
Object, same as item for updates
43 44 45 |
# File 'lib/my_john_deere_api/request/update/base.rb', line 43 def object @object ||= item end |
#request ⇒ Object
Make the request, if the instance is valid
34 35 36 37 38 |
# File 'lib/my_john_deere_api/request/update/base.rb', line 34 def request validate! @response = accessor.put(resource, request_body.to_json, headers) end |