rescue_groups 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/.gitignore +4 -0
- data/.travis.yml +3 -0
- data/Gemfile +3 -0
- data/Gemfile.lock +90 -0
- data/LICENSE.txt +22 -0
- data/README.md +226 -0
- data/Rakefile +30 -0
- data/config/config.rb +26 -0
- data/config/initializer.rb +15 -0
- data/docs/animal_field.md +138 -0
- data/docs/event_field.md +20 -0
- data/docs/organization_field.md +25 -0
- data/fields/animal_field.rb +152 -0
- data/fields/event_field.rb +35 -0
- data/fields/organization_field.rb +40 -0
- data/fields/picture_field.rb +30 -0
- data/lib/api_client.rb +29 -0
- data/lib/queryable.rb +79 -0
- data/lib/relationable.rb +76 -0
- data/lib/remote_client.rb +29 -0
- data/lib/remote_model.rb +47 -0
- data/lib/requests/find.rb +29 -0
- data/lib/requests/invalid_client.rb +1 -0
- data/lib/requests/where.rb +94 -0
- data/lib/response.rb +48 -0
- data/models/animal.rb +57 -0
- data/models/event.rb +41 -0
- data/models/organization.rb +41 -0
- data/models/picture.rb +26 -0
- data/rescue_groups.gemspec +28 -0
- data/rescue_groups.rb +27 -0
- data/search/animal_search.rb +15 -0
- data/search/base_search.rb +72 -0
- data/search/event_search.rb +15 -0
- data/search/filter.rb +49 -0
- data/search/organization_search.rb +15 -0
- data/spec/fixtures/animal/find.json +1 -0
- data/spec/fixtures/animal/where.json +1 -0
- data/spec/fixtures/error.json +20 -0
- data/spec/fixtures/event/find.json +1 -0
- data/spec/fixtures/event/where.json +1 -0
- data/spec/fixtures/organization/find.json +1 -0
- data/spec/fixtures/organization/where.json +1 -0
- data/spec/fixtures/test_constants.rb +12 -0
- data/spec/integration/animal_spec.rb +55 -0
- data/spec/integration/event_spec.rb +33 -0
- data/spec/integration/organization_spec.rb +35 -0
- data/spec/lib/queryable_spec.rb +257 -0
- data/spec/lib/relationable_spec.rb +113 -0
- data/spec/lib/remote_client_spec.rb +27 -0
- data/spec/lib/requests/find_spec.rb +97 -0
- data/spec/lib/requests/where_spec.rb +267 -0
- data/spec/lib/response_spec.rb +99 -0
- data/spec/models/animal_spec.rb +131 -0
- data/spec/models/event_spec.rb +105 -0
- data/spec/models/organization_spec.rb +112 -0
- data/spec/models/picture_spec.rb +87 -0
- data/spec/search/animal_search_spec.rb +8 -0
- data/spec/search/event_search_spec.rb +8 -0
- data/spec/search/filter_spec.rb +39 -0
- data/spec/search/organization_search_spec.rb +8 -0
- data/spec/spec_helper.rb +340 -0
- data/spec/support/model_spec.rb +47 -0
- data/spec/support/searchable_spec.rb +15 -0
- data/support/animal_mock.rb +215 -0
- data/support/base_mock.rb +44 -0
- data/support/event_mock.rb +48 -0
- data/support/organization_mock.rb +53 -0
- data/version.rb +3 -0
- metadata +242 -0
@@ -0,0 +1,47 @@
|
|
1
|
+
require_relative '../spec_helper'
|
2
|
+
|
3
|
+
shared_examples 'a model' do |known_attributes|
|
4
|
+
describe '#initialize' do
|
5
|
+
subject { described_class.new(attributes) }
|
6
|
+
|
7
|
+
context 'known attributes are set' do
|
8
|
+
let(:attributes) { known_attributes }
|
9
|
+
|
10
|
+
it 'sets the attributes' do
|
11
|
+
known_attributes.each do |key, value|
|
12
|
+
mapped_attribute = described_class.object_fields::FIELDS.key(key)
|
13
|
+
expect(subject.send(mapped_attribute)).to eq(value)
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
context 'known and unknown attributes are present' do
|
19
|
+
let(:attributes) do
|
20
|
+
known_attributes.merge({ something_random: true })
|
21
|
+
end
|
22
|
+
|
23
|
+
it 'sets the attributes known' do
|
24
|
+
known_attributes.each do |key, value|
|
25
|
+
mapped_attribute = described_class.object_fields::FIELDS.key(key)
|
26
|
+
expect(subject.send(mapped_attribute)).to eq(value)
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
it 'does not include the uknown attributes' do
|
31
|
+
expect(subject).to_not respond_to(:something_random)
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
context 'only uknown attributes are present' do
|
36
|
+
let(:attributes) { { something_random: true } }
|
37
|
+
|
38
|
+
it 'does not set them' do
|
39
|
+
expect(subject).to_not respond_to(:something_random)
|
40
|
+
end
|
41
|
+
|
42
|
+
it 'has empty attributes' do
|
43
|
+
expect(subject.attributes.values.compact).to eq([])
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
require_relative '../spec_helper'
|
2
|
+
|
3
|
+
shared_examples 'a searchable' do
|
4
|
+
describe '#as_json' do
|
5
|
+
it 'has expected keys' do
|
6
|
+
expect(subject.as_json).to include(:resultStart,
|
7
|
+
:resultLimit,
|
8
|
+
:resultSort,
|
9
|
+
:resultOrder,
|
10
|
+
:calcFoundRows,
|
11
|
+
:filters,
|
12
|
+
:fields)
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,215 @@
|
|
1
|
+
require_relative '../models/animal'
|
2
|
+
require_relative './base_mock'
|
3
|
+
|
4
|
+
module RescueGroups
|
5
|
+
class AnimalMock < BaseMock
|
6
|
+
class << self
|
7
|
+
# method: mocked_class
|
8
|
+
# purpose: Used by BaseMock, defines which object
|
9
|
+
# within the RescueGroups namespace to
|
10
|
+
# initialize with test_hash
|
11
|
+
# param: none
|
12
|
+
# return: <Constant> Name of the class to initialize with
|
13
|
+
def mocked_class
|
14
|
+
Animal
|
15
|
+
end
|
16
|
+
|
17
|
+
# method: test_hash
|
18
|
+
# purpose: Define attributes relevant to a test version
|
19
|
+
# of this object.
|
20
|
+
# param: none
|
21
|
+
# return: <Hash> hash of values that would constitute
|
22
|
+
# a decent set of attributes for this class
|
23
|
+
def test_hash
|
24
|
+
{
|
25
|
+
"animalID"=>"1001923",
|
26
|
+
"animalOrgID"=>"1850",
|
27
|
+
"animalActivityLevel"=>"",
|
28
|
+
"animalAdoptionFee"=>"",
|
29
|
+
"animalAltered"=>"",
|
30
|
+
"animalAvailableDate"=>"",
|
31
|
+
"animalBirthdate"=>"",
|
32
|
+
"animalBirthdateExact"=>"No",
|
33
|
+
"animalBreed"=>"Pembroke Welsh Corgi (short coat)",
|
34
|
+
"animalCoatLength"=>"Short",
|
35
|
+
"animalColor"=>nil, "animalColorID"=>nil, "animalColorDetails"=>nil, "animalCourtesy"=>"No",
|
36
|
+
"animalDeclawed"=>"",
|
37
|
+
"animalDescription"=>"<div class=\"rgDescription\"><p>Addie is a 16 month old, purebred Pembroke Welsh Corgi! Addie enjoys playing frisbee or catch with anything! Although she is content being independent while enjoying a chew bone or favorite toy, she does crave attention. She enjoys going for walks, however, with her short legs, she does tire out and then enjoys a nice nap! </p><br> <p><font size=\"2\" face=\"Arial, Helvetica, sans-serif\"><strong>For more information please fill out <a href=\"http://fs7.formsite.com/vchess/form093291316/index.html\">APPLICATION</a></strong></font></p><br> <p class=\"style4 style98 style106\"><font size=\"2\"><span class=\"style4 style120 style128\"><font color=\"#006600\" face=\"Arial, Helvetica, sans-serif\">Our Pets can be seen upon appointment or in person every Saturday. </font></span></font></p><br> <p class=\"style4 style98 style106\"><font color=\"#660033\" size=\"2\" face=\"Arial, Helvetica, sans-serif\"><span class=\"style129 style4\">Please visit our <a href=\"http://www.tarasdream.org/events.html\">EVENTS PAGE</a> for more information on our time and locations.</span></font></p><br> <p class=\"style98 style4\"><strong><font size=\"2\" face=\"Arial, Helvetica, sans-serif\">Pets listed in TARA's web site are eligible to a<font color=\"#FF0000\"> two week trial</font>.</font></strong></p><br> <p class=\"style117\"><font size=\"2\" face=\"Arial, Helvetica, sans-serif\"><span class=\"style101\">Adoption fee varies</span><font color=\"#0000FF\">, usually from</font> <font color=\"#990000\">$150.00</font></font><font color=\"#990000\" size=\"2\" face=\"Arial, Helvetica, sans-serif\">.00<font color=\"#0000FF\"> to</font> $250.00</font><font color=\"#0000FF\" size=\"2\" face=\"Arial, Helvetica, sans-serif\">.</font></p><br> <p class=\"style4 style98 style106\"><font size=\"2\" face=\"Arial, Helvetica, sans-serif\"> For more information, please visit our <a href=\"http://www.tarasdream.org/\">Web Site</a>. </font></p><br> <p class=\"style117\"> <font size=\"2\" face=\"Arial, Helvetica, sans-serif\"><a href=\"http://fs7.formsite.com/vchess/form109883748/index.html\">Email T.A.R.A.</a> | <a href=\"http://www.tarasdream.org/\">T.A.R.A.'s Web Site</a> | <a href=\"http://fs7.formsite.com/vchess/form093291316/index.html\"> On-Line Application</a></font></p></div>",
|
38
|
+
"animalDescriptionPlain"=>"Addie is a 16 month old, purebred Pembroke Welsh Corgi! Addie enjoys playing frisbee or catch with anything! Although she is content being independent while enjoying a chew bone or favorite toy, she does crave attention. She enjoys going for walks, however, with her short legs, she does tire out and then enjoys a nice nap! For more information please fill out APPLICATION Our Pets can be seen upon appointment or in person every Saturday. Please visit our EVENTS PAGE for more information on our time and locations. Pets listed in TARA's web site are eligible to a two week trial. Adoption fee varies, usually from $150.00.00 to $250.00. For more information, please visit our Web Site. Email T.A.R.A. | T.A.R.A.'s Web Site | On-Line Application",
|
39
|
+
"animalDistinguishingMarks"=>"",
|
40
|
+
"animalEarType"=>"",
|
41
|
+
"animalEnergyLevel"=>"",
|
42
|
+
"animalExerciseNeeds"=>"",
|
43
|
+
"animalEyeColor"=>"",
|
44
|
+
"animalFence"=>"",
|
45
|
+
"animalFound"=>"No",
|
46
|
+
"animalFoundDate"=>"",
|
47
|
+
"animalFoundPostalcode"=>"",
|
48
|
+
"animalGeneralAge"=>"Young",
|
49
|
+
"animalGeneralSizePotential"=>"Small",
|
50
|
+
"animalGroomingNeeds"=>"",
|
51
|
+
"animalHousetrained"=>"",
|
52
|
+
"animalIndoorOutdoor"=>"",
|
53
|
+
"animalKillDate"=>"",
|
54
|
+
"animalKillReason"=>"",
|
55
|
+
"animalLocation"=>"64052",
|
56
|
+
"animalLocationCitystate"=>"Independence, MO",
|
57
|
+
"animalMicrochipped"=>"",
|
58
|
+
"animalMixedBreed"=>"",
|
59
|
+
"animalName"=>"Addie",
|
60
|
+
"animalSpecialneeds"=>"",
|
61
|
+
"animalSpecialneedsDescription"=>nil, "animalNeedsFoster"=>"No",
|
62
|
+
"animalNewPeople"=>"",
|
63
|
+
"animalNotHousetrainedReason"=>"",
|
64
|
+
"animalObedienceTraining"=>"",
|
65
|
+
"animalOKWithAdults"=>"",
|
66
|
+
"animalOKWithCats"=>"",
|
67
|
+
"animalOKWithDogs"=>"",
|
68
|
+
"animalOKWithKids"=>"",
|
69
|
+
"animalOwnerExperience"=>"",
|
70
|
+
"animalPattern"=>nil, "animalPatternID"=>"0",
|
71
|
+
"animalAdoptionPending"=>"No",
|
72
|
+
"animalPrimaryBreed"=>"Pembroke Welsh Corgi",
|
73
|
+
"animalPrimaryBreedID"=>"585",
|
74
|
+
"animalRescueID"=>"",
|
75
|
+
"animalSearchString"=>"Addie Female Small Dogs Pembroke Welsh Corgi (short coat)s",
|
76
|
+
"animalSecondaryBreed"=>nil, "animalSecondaryBreedID"=>nil, "animalSex"=>"Female",
|
77
|
+
"animalShedding"=>"",
|
78
|
+
"animalSizeCurrent"=>nil, "animalSizePotential"=>nil, "animalSizeUOM"=>nil, "animalSpecies"=>"Dog",
|
79
|
+
"animalSpeciesID"=>"Dog",
|
80
|
+
"animalSponsorable"=>"No",
|
81
|
+
"animalSponsors"=>nil, "animalSponsorshipDetails"=>nil, "animalSponsorshipMinimum"=>nil, "animalStatus"=>"Adopted",
|
82
|
+
"animalStatusID"=>"3",
|
83
|
+
"animalSummary"=>nil, "animalTailType"=>"",
|
84
|
+
"animalThumbnailUrl"=>"https://s3.amazonaws.com/filestore.rescuegroups.org/1850/pictures/animals/1001/1001923/2161559_100x115.jpg",
|
85
|
+
"animalUptodate"=>"Yes",
|
86
|
+
"animalUpdatedDate"=>"10/8/2014 10:56 AM",
|
87
|
+
"animalUrl"=>"http://tarasdream.rescuegroups.org/animals/detail?AnimalID=1001923",
|
88
|
+
"animalVocal"=>"",
|
89
|
+
"animalYardRequired"=>"",
|
90
|
+
"animalAffectionate"=>"",
|
91
|
+
"animalApartment"=>"",
|
92
|
+
"animalCratetrained"=>"",
|
93
|
+
"animalDrools"=>"",
|
94
|
+
"animalEagerToPlease"=>"",
|
95
|
+
"animalEscapes"=>"",
|
96
|
+
"animalEventempered"=>"",
|
97
|
+
"animalFetches"=>"",
|
98
|
+
"animalGentle"=>"",
|
99
|
+
"animalGoodInCar"=>"",
|
100
|
+
"animalGoofy"=>"",
|
101
|
+
"animalHasAllergies"=>"",
|
102
|
+
"animalHearingImpaired"=>"",
|
103
|
+
"animalHypoallergenic"=>"",
|
104
|
+
"animalIndependent"=>"",
|
105
|
+
"animalIntelligent"=>"",
|
106
|
+
"animalLap"=>"",
|
107
|
+
"animalLeashtrained"=>"",
|
108
|
+
"animalNeedsCompanionAnimal"=>"",
|
109
|
+
"animalNoCold"=>"",
|
110
|
+
"animalNoFemaleDogs"=>"",
|
111
|
+
"animalNoHeat"=>"",
|
112
|
+
"animalNoLargeDogs"=>"",
|
113
|
+
"animalNoMaleDogs"=>"",
|
114
|
+
"animalNoSmallDogs"=>"",
|
115
|
+
"animalObedient"=>"",
|
116
|
+
"animalOKForSeniors"=>"",
|
117
|
+
"animalOKWithFarmAnimals"=>"",
|
118
|
+
"animalOlderKidsOnly"=>"",
|
119
|
+
"animalOngoingMedical"=>"",
|
120
|
+
"animalPlayful"=>"",
|
121
|
+
"animalPlaysToys"=>"",
|
122
|
+
"animalPredatory"=>"",
|
123
|
+
"animalProtective"=>"",
|
124
|
+
"animalSightImpaired"=>"",
|
125
|
+
"animalSkittish"=>"",
|
126
|
+
"animalSpecialDiet"=>"",
|
127
|
+
"animalSwims"=>"",
|
128
|
+
"animalTimid"=>"",
|
129
|
+
"fosterEmail"=>"tjsadler1980@gmail.com",
|
130
|
+
"fosterFirstname"=>"Tracey",
|
131
|
+
"fosterLastname"=>"",
|
132
|
+
"fosterName"=>"Tracey",
|
133
|
+
"fosterPhoneCell"=>"",
|
134
|
+
"fosterPhoneHome"=>"",
|
135
|
+
"fosterSalutation"=>"",
|
136
|
+
"locationAddress"=>nil, "locationCity"=>nil, "locationCountry"=>nil, "locationUrl"=>nil, "locationName"=>nil, "locationPhone"=>nil, "locationState"=>nil, "locationPostalcode"=>nil, "animalPictures"=>[{"mediaID"=>"2161559",
|
137
|
+
"mediaOrder"=>"1",
|
138
|
+
"lastUpdated"=>"10/27/2008 9:04 PM",
|
139
|
+
"fileSize"=>"46190",
|
140
|
+
"resolutionX"=>"500",
|
141
|
+
"resolutionY"=>"575",
|
142
|
+
"fileNameFullsize"=>"2161559_500x575.jpg",
|
143
|
+
"fileNameThumbnail"=>"2161559_100x115.jpg",
|
144
|
+
"urlSecureFullsize"=>"https://s3.amazonaws.com/filestore.rescuegroups.org/1850/pictures/animals/1001/1001923/2161559_500x575.jpg",
|
145
|
+
"urlSecureThumbnail"=>"https://s3.amazonaws.com/filestore.rescuegroups.org/1850/pictures/animals/1001/1001923/2161559_100x115.jpg",
|
146
|
+
"urlInsecureFullsize"=>"http://s3.amazonaws.com/filestore.rescuegroups.org/1850/pictures/animals/1001/1001923/2161559_500x575.jpg",
|
147
|
+
"urlInsecureThumbnail"=>"http://s3.amazonaws.com/filestore.rescuegroups.org/1850/pictures/animals/1001/1001923/2161559_100x115.jpg",
|
148
|
+
"original"=>{"type"=>"Original",
|
149
|
+
"fileSize"=>"46190",
|
150
|
+
"resolutionX"=>"500",
|
151
|
+
"resolutionY"=>"575",
|
152
|
+
"url"=>"https://s3.amazonaws.com/filestore.rescuegroups.org/1850/pictures/animals/1001/1001923/2161559_500x575.jpg"}, "large"=>{"type"=>"Large",
|
153
|
+
"fileSize"=>"46190",
|
154
|
+
"resolutionX"=>"500",
|
155
|
+
"resolutionY"=>"575",
|
156
|
+
"url"=>"https://s3.amazonaws.com/filestore.rescuegroups.org/1850/pictures/animals/1001/1001923/2161559_500x575.jpg"}, "small"=>{"type"=>"Small",
|
157
|
+
"fileSize"=>"4104",
|
158
|
+
"resolutionX"=>"100",
|
159
|
+
"resolutionY"=>"115",
|
160
|
+
"url"=>"https://s3.amazonaws.com/filestore.rescuegroups.org/1850/pictures/animals/1001/1001923/2161559_100x115.jpg"}}, {"mediaID"=>"2161560",
|
161
|
+
"mediaOrder"=>"2",
|
162
|
+
"lastUpdated"=>"10/27/2008 9:04 PM",
|
163
|
+
"fileSize"=>"147911",
|
164
|
+
"resolutionX"=>"484",
|
165
|
+
"resolutionY"=>"830",
|
166
|
+
"fileNameFullsize"=>"2161560_484x830.jpg",
|
167
|
+
"fileNameThumbnail"=>"2161560_100x171.jpg",
|
168
|
+
"urlSecureFullsize"=>"https://s3.amazonaws.com/filestore.rescuegroups.org/1850/pictures/animals/1001/1001923/2161560_484x830.jpg",
|
169
|
+
"urlSecureThumbnail"=>"https://s3.amazonaws.com/filestore.rescuegroups.org/1850/pictures/animals/1001/1001923/2161560_100x171.jpg",
|
170
|
+
"urlInsecureFullsize"=>"http://s3.amazonaws.com/filestore.rescuegroups.org/1850/pictures/animals/1001/1001923/2161560_484x830.jpg",
|
171
|
+
"urlInsecureThumbnail"=>"http://s3.amazonaws.com/filestore.rescuegroups.org/1850/pictures/animals/1001/1001923/2161560_100x171.jpg",
|
172
|
+
"original"=>{"type"=>"Original",
|
173
|
+
"fileSize"=>"147911",
|
174
|
+
"resolutionX"=>"484",
|
175
|
+
"resolutionY"=>"830",
|
176
|
+
"url"=>"https://s3.amazonaws.com/filestore.rescuegroups.org/1850/pictures/animals/1001/1001923/2161560_484x830.jpg"}, "large"=>{"type"=>"Large",
|
177
|
+
"fileSize"=>"147911",
|
178
|
+
"resolutionX"=>"484",
|
179
|
+
"resolutionY"=>"830",
|
180
|
+
"url"=>"https://s3.amazonaws.com/filestore.rescuegroups.org/1850/pictures/animals/1001/1001923/2161560_484x830.jpg"}, "small"=>{"type"=>"Small",
|
181
|
+
"fileSize"=>"4666",
|
182
|
+
"resolutionX"=>"100",
|
183
|
+
"resolutionY"=>"171",
|
184
|
+
"url"=>"https://s3.amazonaws.com/filestore.rescuegroups.org/1850/pictures/animals/1001/1001923/2161560_100x171.jpg"}}, {"mediaID"=>"2161561",
|
185
|
+
"mediaOrder"=>"3",
|
186
|
+
"lastUpdated"=>"10/27/2008 9:04 PM",
|
187
|
+
"fileSize"=>"31174",
|
188
|
+
"resolutionX"=>"500",
|
189
|
+
"resolutionY"=>"466",
|
190
|
+
"fileNameFullsize"=>"2161561_500x466.jpg",
|
191
|
+
"fileNameThumbnail"=>"2161561_100x93.jpg",
|
192
|
+
"urlSecureFullsize"=>"https://s3.amazonaws.com/filestore.rescuegroups.org/1850/pictures/animals/1001/1001923/2161561_500x466.jpg",
|
193
|
+
"urlSecureThumbnail"=>"https://s3.amazonaws.com/filestore.rescuegroups.org/1850/pictures/animals/1001/1001923/2161561_100x93.jpg",
|
194
|
+
"urlInsecureFullsize"=>"http://s3.amazonaws.com/filestore.rescuegroups.org/1850/pictures/animals/1001/1001923/2161561_500x466.jpg",
|
195
|
+
"urlInsecureThumbnail"=>"http://s3.amazonaws.com/filestore.rescuegroups.org/1850/pictures/animals/1001/1001923/2161561_100x93.jpg",
|
196
|
+
"original"=>{"type"=>"Original",
|
197
|
+
"fileSize"=>"31174",
|
198
|
+
"resolutionX"=>"500",
|
199
|
+
"resolutionY"=>"466",
|
200
|
+
"url"=>"https://s3.amazonaws.com/filestore.rescuegroups.org/1850/pictures/animals/1001/1001923/2161561_500x466.jpg"}, "large"=>{"type"=>"Large",
|
201
|
+
"fileSize"=>"31174",
|
202
|
+
"resolutionX"=>"500",
|
203
|
+
"resolutionY"=>"466",
|
204
|
+
"url"=>"https://s3.amazonaws.com/filestore.rescuegroups.org/1850/pictures/animals/1001/1001923/2161561_500x466.jpg"}, "small"=>{"type"=>"Small",
|
205
|
+
"fileSize"=>"2368",
|
206
|
+
"resolutionX"=>"100",
|
207
|
+
"resolutionY"=>"93",
|
208
|
+
"url"=>"https://s3.amazonaws.com/filestore.rescuegroups.org/1850/pictures/animals/1001/1001923/2161561_100x93.jpg"}}],
|
209
|
+
"animalVideos"=>[],
|
210
|
+
"animalVideoUrls"=>[]
|
211
|
+
}
|
212
|
+
end
|
213
|
+
end
|
214
|
+
end
|
215
|
+
end
|
@@ -0,0 +1,44 @@
|
|
1
|
+
module RescueGroups
|
2
|
+
class BaseMock
|
3
|
+
class << self
|
4
|
+
# method: find
|
5
|
+
# purpose: Instantiate and return a new
|
6
|
+
# mocked version of the desired model
|
7
|
+
# param: none
|
8
|
+
# return: <Object> initialized object with values from
|
9
|
+
# the test_hash
|
10
|
+
def find
|
11
|
+
mocked_class.new(test_hash)
|
12
|
+
end
|
13
|
+
|
14
|
+
# method: where
|
15
|
+
# purpose: Instantiate and return an array of new
|
16
|
+
# mocked versions of the desired model
|
17
|
+
# param: none
|
18
|
+
# return: <Array> of objects
|
19
|
+
# initialized object with values from
|
20
|
+
# the test_hash
|
21
|
+
def where
|
22
|
+
[find]
|
23
|
+
end
|
24
|
+
|
25
|
+
# method: find_not_found
|
26
|
+
# purpose: Raise exception equivalent to the one
|
27
|
+
# raised when an object is not found
|
28
|
+
# param: none
|
29
|
+
# return: none
|
30
|
+
def find_not_found
|
31
|
+
fail "Unable to find #{ self.class.name }"
|
32
|
+
end
|
33
|
+
|
34
|
+
# method: where_not_found
|
35
|
+
# purpose: Return an empty <Array> to emulate
|
36
|
+
# when a where call returns 0 results
|
37
|
+
# param: none
|
38
|
+
# return: <Array> empty array
|
39
|
+
def where_not_found
|
40
|
+
[]
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
@@ -0,0 +1,48 @@
|
|
1
|
+
require_relative '../models/event'
|
2
|
+
require_relative './base_mock'
|
3
|
+
|
4
|
+
module RescueGroups
|
5
|
+
class EventMock < BaseMock
|
6
|
+
class << self
|
7
|
+
# method: mocked_class
|
8
|
+
# purpose: Used by BaseMock, defines which object
|
9
|
+
# within the RescueGroups namespace to
|
10
|
+
# initialize with test_hash
|
11
|
+
# param: none
|
12
|
+
# return: <Constant> Name of the class to initialize with
|
13
|
+
def mocked_class
|
14
|
+
Event
|
15
|
+
end
|
16
|
+
|
17
|
+
# method: test_hash
|
18
|
+
# purpose: Define attributes relevant to a test version
|
19
|
+
# of this object.
|
20
|
+
# param: none
|
21
|
+
# return: <Hash> hash of values that would constitute
|
22
|
+
# a decent set of attributes for this class
|
23
|
+
def test_hash
|
24
|
+
{
|
25
|
+
"eventID"=>"36385",
|
26
|
+
"eventOrgID"=>"4516",
|
27
|
+
"eventName"=>"Weekly Mobile Adoption Event!!!",
|
28
|
+
"eventStart"=>"1/22/2011 10:00 AM",
|
29
|
+
"eventEnd"=>"1/22/2011 3:00 PM",
|
30
|
+
"eventUrl"=>"",
|
31
|
+
"eventDescription"=>"Come meet some of our fabulous dogs. Find yourself a new best friend or help us save a life by fostering! If you're interested in a particular dog, please email us and let us know so we can be sure she or he is there!",
|
32
|
+
"eventLocationID"=>"10422",
|
33
|
+
"eventSpecies"=>["Dog"],
|
34
|
+
"locationName"=>"Pet Food Express",
|
35
|
+
"locationUrl"=>"",
|
36
|
+
"locationAddress"=>"Dolores and Market St.",
|
37
|
+
"locationCity"=>"San Francisco ",
|
38
|
+
"locationState"=>"CA",
|
39
|
+
"locationPostalcode"=>"94114",
|
40
|
+
"locationCountry"=>"United States",
|
41
|
+
"locationPhone"=>"",
|
42
|
+
"locationPhoneExt"=>"",
|
43
|
+
"locationEvents"=>"0"
|
44
|
+
}
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
@@ -0,0 +1,53 @@
|
|
1
|
+
require_relative '../models/organization'
|
2
|
+
require_relative './base_mock'
|
3
|
+
|
4
|
+
module RescueGroups
|
5
|
+
class OrganizationMock < BaseMock
|
6
|
+
class << self
|
7
|
+
# method: mocked_class
|
8
|
+
# purpose: Used by BaseMock, defines which object
|
9
|
+
# within the RescueGroups namespace to
|
10
|
+
# initialize with test_hash
|
11
|
+
# param: none
|
12
|
+
# return: <Constant> Name of the class to initialize with
|
13
|
+
def mocked_class
|
14
|
+
Organization
|
15
|
+
end
|
16
|
+
|
17
|
+
# method: test_hash
|
18
|
+
# purpose: Define attributes relevant to a test version
|
19
|
+
# of this object.
|
20
|
+
# param: none
|
21
|
+
# return: <Hash> hash of values that would constitute
|
22
|
+
# a decent set of attributes for this class
|
23
|
+
def test_hash
|
24
|
+
{
|
25
|
+
"orgID"=>"660",
|
26
|
+
"orgAbout"=>"",
|
27
|
+
"orgAdoptionProcess"=>"Adoption Fees are:$250 - Adults & $300 - Puppies. All are vetted, spay/neutered, microchipped and other known medical conditions addressed",
|
28
|
+
"orgAdoptionUrl"=>"",
|
29
|
+
"orgCommonapplicationAccept"=>"No",
|
30
|
+
"orgDonationUrl"=>"",
|
31
|
+
"orgEmail"=>"info@atdr.org",
|
32
|
+
"orgFacebookUrl"=>"http://www.facebook.com/pages/All-Texas-Dachshund-Rescue-ATDR/55375608508",
|
33
|
+
"orgFax"=>"",
|
34
|
+
"orgLocation"=>"77584",
|
35
|
+
"orgAddress"=>"P.O. Box 841336",
|
36
|
+
"orgCity"=>"Pearland",
|
37
|
+
"orgCountry"=>"United States",
|
38
|
+
"orgPostalcode"=>"77584",
|
39
|
+
"orgState"=>"TX",
|
40
|
+
"orgPlus4"=>"",
|
41
|
+
"orgMeetPets"=>"Visit us online at our website and Facebook page or at one of our events",
|
42
|
+
"orgName"=>"All Texas Dachshund Rescue",
|
43
|
+
"orgPhone"=>"",
|
44
|
+
"orgServeAreas"=>"State of Texas including the Houston, DFW, Austin & San Antonio metroplexes",
|
45
|
+
"orgServices"=>"Adoptions",
|
46
|
+
"orgSponsorshipUrl"=>"",
|
47
|
+
"orgType"=>"Rescue",
|
48
|
+
"orgWebsiteUrl"=>"http://www.atdr.org"
|
49
|
+
}
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
data/version.rb
ADDED
metadata
ADDED
@@ -0,0 +1,242 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: rescue_groups
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Jake Yesbeck
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2015-09-13 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: httparty
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: 0.13.0
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: 0.13.0
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: bundler
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '1.3'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '1.3'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rake
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ">="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: rspec
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: pry
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - ">="
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - ">="
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: webmock
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - ">="
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '0'
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - ">="
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '0'
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: guard-rspec
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - ">="
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: '0'
|
104
|
+
type: :development
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - ">="
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: '0'
|
111
|
+
description: Ruby ORM for the RescueGroups API. On demand pet data provided for free
|
112
|
+
by RescueGroups.org.
|
113
|
+
email: yesbeckjs@gmail.com
|
114
|
+
executables: []
|
115
|
+
extensions: []
|
116
|
+
extra_rdoc_files: []
|
117
|
+
files:
|
118
|
+
- ".gitignore"
|
119
|
+
- ".travis.yml"
|
120
|
+
- Gemfile
|
121
|
+
- Gemfile.lock
|
122
|
+
- LICENSE.txt
|
123
|
+
- README.md
|
124
|
+
- Rakefile
|
125
|
+
- config/config.rb
|
126
|
+
- config/initializer.rb
|
127
|
+
- docs/animal_field.md
|
128
|
+
- docs/event_field.md
|
129
|
+
- docs/organization_field.md
|
130
|
+
- fields/animal_field.rb
|
131
|
+
- fields/event_field.rb
|
132
|
+
- fields/organization_field.rb
|
133
|
+
- fields/picture_field.rb
|
134
|
+
- lib/api_client.rb
|
135
|
+
- lib/queryable.rb
|
136
|
+
- lib/relationable.rb
|
137
|
+
- lib/remote_client.rb
|
138
|
+
- lib/remote_model.rb
|
139
|
+
- lib/requests/find.rb
|
140
|
+
- lib/requests/invalid_client.rb
|
141
|
+
- lib/requests/where.rb
|
142
|
+
- lib/response.rb
|
143
|
+
- models/animal.rb
|
144
|
+
- models/event.rb
|
145
|
+
- models/organization.rb
|
146
|
+
- models/picture.rb
|
147
|
+
- rescue_groups.gemspec
|
148
|
+
- rescue_groups.rb
|
149
|
+
- search/animal_search.rb
|
150
|
+
- search/base_search.rb
|
151
|
+
- search/event_search.rb
|
152
|
+
- search/filter.rb
|
153
|
+
- search/organization_search.rb
|
154
|
+
- spec/fixtures/animal/find.json
|
155
|
+
- spec/fixtures/animal/where.json
|
156
|
+
- spec/fixtures/error.json
|
157
|
+
- spec/fixtures/event/find.json
|
158
|
+
- spec/fixtures/event/where.json
|
159
|
+
- spec/fixtures/organization/find.json
|
160
|
+
- spec/fixtures/organization/where.json
|
161
|
+
- spec/fixtures/test_constants.rb
|
162
|
+
- spec/integration/animal_spec.rb
|
163
|
+
- spec/integration/event_spec.rb
|
164
|
+
- spec/integration/organization_spec.rb
|
165
|
+
- spec/lib/queryable_spec.rb
|
166
|
+
- spec/lib/relationable_spec.rb
|
167
|
+
- spec/lib/remote_client_spec.rb
|
168
|
+
- spec/lib/requests/find_spec.rb
|
169
|
+
- spec/lib/requests/where_spec.rb
|
170
|
+
- spec/lib/response_spec.rb
|
171
|
+
- spec/models/animal_spec.rb
|
172
|
+
- spec/models/event_spec.rb
|
173
|
+
- spec/models/organization_spec.rb
|
174
|
+
- spec/models/picture_spec.rb
|
175
|
+
- spec/search/animal_search_spec.rb
|
176
|
+
- spec/search/event_search_spec.rb
|
177
|
+
- spec/search/filter_spec.rb
|
178
|
+
- spec/search/organization_search_spec.rb
|
179
|
+
- spec/spec_helper.rb
|
180
|
+
- spec/support/model_spec.rb
|
181
|
+
- spec/support/searchable_spec.rb
|
182
|
+
- support/animal_mock.rb
|
183
|
+
- support/base_mock.rb
|
184
|
+
- support/event_mock.rb
|
185
|
+
- support/organization_mock.rb
|
186
|
+
- version.rb
|
187
|
+
homepage: http://rubygems.org/gems/rescue_groups
|
188
|
+
licenses:
|
189
|
+
- MIT
|
190
|
+
metadata: {}
|
191
|
+
post_install_message:
|
192
|
+
rdoc_options: []
|
193
|
+
require_paths:
|
194
|
+
- lib
|
195
|
+
- models
|
196
|
+
- search
|
197
|
+
- config
|
198
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
199
|
+
requirements:
|
200
|
+
- - ">="
|
201
|
+
- !ruby/object:Gem::Version
|
202
|
+
version: 2.0.0
|
203
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
204
|
+
requirements:
|
205
|
+
- - ">="
|
206
|
+
- !ruby/object:Gem::Version
|
207
|
+
version: '0'
|
208
|
+
requirements: []
|
209
|
+
rubyforge_project:
|
210
|
+
rubygems_version: 2.4.6
|
211
|
+
signing_key:
|
212
|
+
specification_version: 4
|
213
|
+
summary: RescueGroups.org API wrapper
|
214
|
+
test_files:
|
215
|
+
- spec/fixtures/animal/find.json
|
216
|
+
- spec/fixtures/animal/where.json
|
217
|
+
- spec/fixtures/error.json
|
218
|
+
- spec/fixtures/event/find.json
|
219
|
+
- spec/fixtures/event/where.json
|
220
|
+
- spec/fixtures/organization/find.json
|
221
|
+
- spec/fixtures/organization/where.json
|
222
|
+
- spec/fixtures/test_constants.rb
|
223
|
+
- spec/integration/animal_spec.rb
|
224
|
+
- spec/integration/event_spec.rb
|
225
|
+
- spec/integration/organization_spec.rb
|
226
|
+
- spec/lib/queryable_spec.rb
|
227
|
+
- spec/lib/relationable_spec.rb
|
228
|
+
- spec/lib/remote_client_spec.rb
|
229
|
+
- spec/lib/requests/find_spec.rb
|
230
|
+
- spec/lib/requests/where_spec.rb
|
231
|
+
- spec/lib/response_spec.rb
|
232
|
+
- spec/models/animal_spec.rb
|
233
|
+
- spec/models/event_spec.rb
|
234
|
+
- spec/models/organization_spec.rb
|
235
|
+
- spec/models/picture_spec.rb
|
236
|
+
- spec/search/animal_search_spec.rb
|
237
|
+
- spec/search/event_search_spec.rb
|
238
|
+
- spec/search/filter_spec.rb
|
239
|
+
- spec/search/organization_search_spec.rb
|
240
|
+
- spec/spec_helper.rb
|
241
|
+
- spec/support/model_spec.rb
|
242
|
+
- spec/support/searchable_spec.rb
|