Class: PostProxy::Model
- Inherits:
-
Object
- Object
- PostProxy::Model
- Defined in:
- lib/postproxy/types.rb
Direct Known Subclasses
ConnectionResponse, DeleteResponse, FacebookParams, Insights, InstagramParams, LinkedInParams, Media, NextSlotResponse, PinterestParams, Placement, PlatformParams, PlatformResult, PlatformStats, Post, PostStats, Profile, ProfileGroup, Queue, StatsRecord, SuccessResponse, ThreadChild, ThreadsParams, TikTokParams, Timeslot, TwitterParams, Webhook, WebhookDelivery, YouTubeParams
Instance Method Summary collapse
-
#initialize(**attrs) ⇒ Model
constructor
A new instance of Model.
- #to_h ⇒ Object
Constructor Details
#initialize(**attrs) ⇒ Model
Returns a new instance of Model.
5 6 7 8 9 10 11 |
# File 'lib/postproxy/types.rb', line 5 def initialize(**attrs) attrs.each do |key, value| if respond_to?(:"#{key}=") send(:"#{key}=", value) end end end |
Instance Method Details
#to_h ⇒ Object
13 14 15 16 17 18 |
# File 'lib/postproxy/types.rb', line 13 def to_h instance_variables.each_with_object({}) do |var, hash| key = var.to_s.delete_prefix("@") hash[key.to_sym] = instance_variable_get(var) end end |