Class: ProcessOut::APIVersion
- Inherits:
-
Object
- Object
- ProcessOut::APIVersion
- Defined in:
- lib/processout/api_version.rb
Instance Attribute Summary collapse
-
#created_at ⇒ Object
Returns the value of attribute created_at.
-
#description ⇒ Object
Returns the value of attribute description.
-
#name ⇒ Object
Returns the value of attribute name.
Instance Method Summary collapse
-
#fill_with_data(data) ⇒ Object
- Fills the object with data coming from the API Params:
data
-
Hash
of data coming from the API.
- Fills the object with data coming from the API Params:
-
#initialize(client, data = {}) ⇒ APIVersion
constructor
- Initializes the APIVersion object Params:
client
ProcessOut
client instancedata
-
data that can be used to fill the object.
- Initializes the APIVersion object Params:
-
#new(data = {}) ⇒ Object
Create a new APIVersion using the current client.
-
#prefill(data) ⇒ Object
- Prefills the object with the data passed as parameters Params:
data
-
Hash
of data.
- Prefills the object with the data passed as parameters Params:
Constructor Details
#initialize(client, data = {}) ⇒ APIVersion
Initializes the APIVersion object Params:
client
-
ProcessOut
client instance data
-
data that can be used to fill the object
32 33 34 35 36 37 38 39 |
# File 'lib/processout/api_version.rb', line 32 def initialize(client, data = {}) @client = client self.name = data.fetch(:name, nil) self.description = data.fetch(:description, nil) self.created_at = data.fetch(:created_at, nil) end |
Instance Attribute Details
#created_at ⇒ Object
Returns the value of attribute created_at.
12 13 14 |
# File 'lib/processout/api_version.rb', line 12 def created_at @created_at end |
#description ⇒ Object
Returns the value of attribute description.
11 12 13 |
# File 'lib/processout/api_version.rb', line 11 def description @description end |
#name ⇒ Object
Returns the value of attribute name.
10 11 12 |
# File 'lib/processout/api_version.rb', line 10 def name @name end |
Instance Method Details
#fill_with_data(data) ⇒ Object
Fills the object with data coming from the API Params:
data
-
Hash
of data coming from the API
49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 |
# File 'lib/processout/api_version.rb', line 49 def fill_with_data(data) if data.nil? return self end if data.include? "name" self.name = data["name"] end if data.include? "description" self.description = data["description"] end if data.include? "created_at" self.created_at = data["created_at"] end self end |
#new(data = {}) ⇒ Object
Create a new APIVersion using the current client
42 43 44 |
# File 'lib/processout/api_version.rb', line 42 def new(data = {}) APIVersion.new(@client, data) end |
#prefill(data) ⇒ Object
Prefills the object with the data passed as parameters Params:
data
-
Hash
of data
69 70 71 72 73 74 75 76 77 78 |
# File 'lib/processout/api_version.rb', line 69 def prefill(data) if data.nil? return self end self.name = data.fetch(:name, self.name) self.description = data.fetch(:description, self.description) self.created_at = data.fetch(:created_at, self.created_at) self end |