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
-
#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
#object ⇒ Object
Object, same as item for updates
35 36 37 |
# File 'lib/my_john_deere_api/request/update/base.rb', line 35 def object @object ||= item end |
#request ⇒ Object
Make the request, if the instance is valid
26 27 28 29 30 |
# File 'lib/my_john_deere_api/request/update/base.rb', line 26 def request validate! @response = client.put(resource, request_body.to_json) end |