Class: Pinch::WebhookType
- Inherits:
-
Object
- Object
- Pinch::WebhookType
- Defined in:
- lib/pinch/models/webhook_type.rb
Instance Attribute Summary collapse
-
#id ⇒ Integer
TODO: Write general description for this method.
-
#name ⇒ String
TODO: Write general description for this method.
Class Method Summary collapse
-
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
Instance Method Summary collapse
-
#initialize(id = nil, name = nil) ⇒ WebhookType
constructor
A new instance of WebhookType.
-
#key_map ⇒ Object
Defines the key map for json serialization.
- #method_missing(method_name) ⇒ Object
-
#to_json ⇒ Object
Creates JSON of the curent object.
Constructor Details
#initialize(id = nil, name = nil) ⇒ WebhookType
Returns a new instance of WebhookType.
14 15 16 17 18 19 |
# File 'lib/pinch/models/webhook_type.rb', line 14 def initialize(id = nil, name = nil) @id = id @name = name end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method_name) ⇒ Object
21 22 23 |
# File 'lib/pinch/models/webhook_type.rb', line 21 def method_missing(method_name) puts "There is no method called '#{method_name}'." end |
Instance Attribute Details
#id ⇒ Integer
TODO: Write general description for this method
8 9 10 |
# File 'lib/pinch/models/webhook_type.rb', line 8 def id @id end |
#name ⇒ String
TODO: Write general description for this method
12 13 14 |
# File 'lib/pinch/models/webhook_type.rb', line 12 def name @name end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash
32 33 34 35 36 37 38 39 40 41 42 43 |
# File 'lib/pinch/models/webhook_type.rb', line 32 def self.from_hash(hash) if hash == nil nil else # Extract variables from the hash id = hash["id"] name = hash["name"] # Create object from extracted values WebhookType.new(id, name) end end |
Instance Method Details
#key_map ⇒ Object
Defines the key map for json serialization
46 47 48 49 50 51 |
# File 'lib/pinch/models/webhook_type.rb', line 46 def key_map hash = {} hash['id'] = id hash['name'] = name hash end |
#to_json ⇒ Object
Creates JSON of the curent object
26 27 28 29 |
# File 'lib/pinch/models/webhook_type.rb', line 26 def to_json hash = key_map hash.to_json end |