Class: MyJohnDeereApi::Request::Individual::Base
- Inherits:
-
Object
- Object
- MyJohnDeereApi::Request::Individual::Base
- Defined in:
- lib/my_john_deere_api/request/individual/base.rb
Direct Known Subclasses
Asset, ContributionDefinition, ContributionProduct, Field, Organization
Instance Attribute Summary collapse
-
#associations ⇒ Object
readonly
Returns the value of attribute associations.
-
#client ⇒ Object
readonly
Returns the value of attribute client.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#response ⇒ Object
readonly
Returns the value of attribute response.
Instance Method Summary collapse
-
#accessor ⇒ Object
client accessor.
-
#initialize(client, id, associations = {}) ⇒ Base
constructor
Initialize with a client, and asset id.
-
#object ⇒ Object
The object being requested, an asset in this case.
Constructor Details
#initialize(client, id, associations = {}) ⇒ Base
Initialize with a client, and asset id
10 11 12 13 14 |
# File 'lib/my_john_deere_api/request/individual/base.rb', line 10 def initialize(client, id, associations = {}) @client = client @id = id @associations = associations end |
Instance Attribute Details
#associations ⇒ Object (readonly)
Returns the value of attribute associations.
5 6 7 |
# File 'lib/my_john_deere_api/request/individual/base.rb', line 5 def associations @associations end |
#client ⇒ Object (readonly)
Returns the value of attribute client.
5 6 7 |
# File 'lib/my_john_deere_api/request/individual/base.rb', line 5 def client @client end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
5 6 7 |
# File 'lib/my_john_deere_api/request/individual/base.rb', line 5 def id @id end |
#response ⇒ Object (readonly)
Returns the value of attribute response.
5 6 7 |
# File 'lib/my_john_deere_api/request/individual/base.rb', line 5 def response @response end |
Instance Method Details
#accessor ⇒ Object
client accessor
19 20 21 22 |
# File 'lib/my_john_deere_api/request/individual/base.rb', line 19 def accessor return @accessor if defined?(@accessor) @accessor = client&.accessor end |
#object ⇒ Object
The object being requested, an asset in this case
27 28 29 30 31 32 |
# File 'lib/my_john_deere_api/request/individual/base.rb', line 27 def object return @object if defined?(@object) request unless response @object = model.new(client, JSON.parse(response.body)) end |