Class: PetfinderV2::Serializers::Organization
- Inherits:
-
Object
- Object
- PetfinderV2::Serializers::Organization
- Defined in:
- lib/petfinder_V2/serializers/organization.rb
Instance Attribute Summary collapse
-
#adoption_policy ⇒ Object
readonly
Returns the value of attribute adoption_policy.
-
#adoption_url ⇒ Object
readonly
Returns the value of attribute adoption_url.
-
#animals_link ⇒ Object
readonly
Returns the value of attribute animals_link.
-
#email ⇒ Object
readonly
Returns the value of attribute email.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#link ⇒ Object
readonly
Returns the value of attribute link.
-
#mission_statement ⇒ Object
readonly
Returns the value of attribute mission_statement.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#phone ⇒ Object
readonly
Returns the value of attribute phone.
-
#url ⇒ Object
readonly
Returns the value of attribute url.
-
#website ⇒ Object
readonly
Returns the value of attribute website.
Class Method Summary collapse
Instance Method Summary collapse
- #address ⇒ Object
- #full_response ⇒ Object
- #hours ⇒ Object
-
#initialize(data) ⇒ Organization
constructor
A new instance of Organization.
- #social_media ⇒ Object
Constructor Details
#initialize(data) ⇒ Organization
Returns a new instance of Organization.
51 52 53 54 55 56 57 58 59 60 61 62 63 64 |
# File 'lib/petfinder_V2/serializers/organization.rb', line 51 def initialize(data) @data = data @id = data['id'] @name = data['name'] @email = data['email'] @phone = data['phone'] @url = data['url'] @website = data['website'] @mission_statement = data['mission_statement'] @adoption_policy = data['adoption']['policy'] @adoption_url = data['adoption']['url'] @link = data['_links']['self']['href'] @animals_link = data['_links']['animals']['href'] end |
Instance Attribute Details
#adoption_policy ⇒ Object (readonly)
Returns the value of attribute adoption_policy.
39 40 41 |
# File 'lib/petfinder_V2/serializers/organization.rb', line 39 def adoption_policy @adoption_policy end |
#adoption_url ⇒ Object (readonly)
Returns the value of attribute adoption_url.
39 40 41 |
# File 'lib/petfinder_V2/serializers/organization.rb', line 39 def adoption_url @adoption_url end |
#animals_link ⇒ Object (readonly)
Returns the value of attribute animals_link.
39 40 41 |
# File 'lib/petfinder_V2/serializers/organization.rb', line 39 def animals_link @animals_link end |
#email ⇒ Object (readonly)
Returns the value of attribute email.
39 40 41 |
# File 'lib/petfinder_V2/serializers/organization.rb', line 39 def email @email end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
39 40 41 |
# File 'lib/petfinder_V2/serializers/organization.rb', line 39 def id @id end |
#link ⇒ Object (readonly)
Returns the value of attribute link.
39 40 41 |
# File 'lib/petfinder_V2/serializers/organization.rb', line 39 def link @link end |
#mission_statement ⇒ Object (readonly)
Returns the value of attribute mission_statement.
39 40 41 |
# File 'lib/petfinder_V2/serializers/organization.rb', line 39 def mission_statement @mission_statement end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
39 40 41 |
# File 'lib/petfinder_V2/serializers/organization.rb', line 39 def name @name end |
#phone ⇒ Object (readonly)
Returns the value of attribute phone.
39 40 41 |
# File 'lib/petfinder_V2/serializers/organization.rb', line 39 def phone @phone end |
#url ⇒ Object (readonly)
Returns the value of attribute url.
39 40 41 |
# File 'lib/petfinder_V2/serializers/organization.rb', line 39 def url @url end |
#website ⇒ Object (readonly)
Returns the value of attribute website.
39 40 41 |
# File 'lib/petfinder_V2/serializers/organization.rb', line 39 def website @website end |
Class Method Details
.process_collection(data) ⇒ Object
32 33 34 35 36 37 |
# File 'lib/petfinder_V2/serializers/organization.rb', line 32 def self.process_collection(data) { pagination: PetfinderV2::Serializers::Pagination.new(data['pagination']), organizations: data['organizations'].map { |o| new(o) } } end |
Instance Method Details
#address ⇒ Object
70 71 72 |
# File 'lib/petfinder_V2/serializers/organization.rb', line 70 def address Address.new(@data['address']) end |
#full_response ⇒ Object
66 67 68 |
# File 'lib/petfinder_V2/serializers/organization.rb', line 66 def full_response @data end |
#hours ⇒ Object
74 75 76 |
# File 'lib/petfinder_V2/serializers/organization.rb', line 74 def hours OrgHours.new(@data['hours']) end |
#social_media ⇒ Object
78 79 80 |
# File 'lib/petfinder_V2/serializers/organization.rb', line 78 def SocialMedia.new(@data['social_media']) end |