PetSearch 0.0.6 → 0.0.7.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 +8 -8
- data/lib/petsearch.rb +5 -1
- data/lib/petsearch/pet.rb +5 -1
- data/lib/petsearch/petclient.rb +5 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
OTczNWExYjMwZjI0ZjM4YTFmODMwYjc2NGE4NDU0NGE3YmM1ZWI4OQ==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
Mzc4OWFjNDMzZjUxN2YxYjcwNjFiN2VlZDZjYTg0NTVlMzQ2YzM4Mw==
|
7
7
|
!binary "U0hBNTEy":
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
YmJjMDEyOTM1ZDE0YWIyMzQzOGY4ZDNlODdhZDA3OGQyNzIyNTEyYTljZTJh
|
10
|
+
ZDJmZWZmYjg5YjE0OThlY2IxMDQ5Mjg3ZjNiYjI0MjMxY2YwZDU3ZWZkYTVj
|
11
|
+
NzYzZDA0ZmMxOWMxZjJmNDE1NjRlYTAyMDY2Mjc3N2JiYmNiZWY=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
OGU0NDY1YmI5OGIxMjViZTI5ZmQyZjU2YTIwYjhmYzNmOTI1ZjViODMzMWFh
|
14
|
+
OGE5OGU2MWIyYjNlZjhlZTljMzIwNWZhYTc5Njc5YTA5MzNkOGIxNDFiNDcw
|
15
|
+
YTU5Mzc4NGQ2YzMxM2E4ODdhMzc3YzkwYmYzNzczN2RjNmE0MzU=
|
data/lib/petsearch.rb
CHANGED
@@ -6,6 +6,7 @@ require 'date'
|
|
6
6
|
require 'petsearch/petclient'
|
7
7
|
require 'petsearch/pet'
|
8
8
|
|
9
|
+
|
9
10
|
class PetSearch
|
10
11
|
attr_accessor :dog, :cat, :bird, :reptile, :horse, :pig, :barnyard, :smallfurry
|
11
12
|
@@options = Hash.new
|
@@ -27,7 +28,7 @@ class PetSearch
|
|
27
28
|
@@options[:animal] = args.grep(/[Dd]og|[Cc]at|[Bb]ird|[Rr]eptile|[Hh]orse|[Pp]ig|[Bb]arnyard|[Ss]mallfurry/).first
|
28
29
|
@@options[:age] = args.grep(/[Bb]aby|[Yy]oung|[Aa]dult|[Ss]enior/).first
|
29
30
|
@@options[:location] = args.grep(/[1..9]/).first
|
30
|
-
@@options[:sex] = args.grep(/[
|
31
|
+
@@options[:sex] = args.grep(/[Ss]ex/).first.downcase.match(/(?<=sex=).*/)[0] if args.grep(/[Ss]ex/).first
|
31
32
|
@@options[:size] = args.grep(/[Ss]m|[Mm]dm|[Ll]rg|[Xx]l/).first.downcase if args.grep(/[Ss]m|[Mm]dm|[Ll]rg|[Xx]l/).first
|
32
33
|
case (@@options[:size])
|
33
34
|
when 'sm'
|
@@ -53,10 +54,13 @@ class PetSearch
|
|
53
54
|
|
54
55
|
def self.search
|
55
56
|
PetClient.search_listings(@@options)
|
57
|
+
|
56
58
|
end
|
57
59
|
|
58
60
|
def self.get_token
|
59
61
|
PetClient.get_token
|
60
62
|
end
|
63
|
+
|
64
|
+
|
61
65
|
end
|
62
66
|
|
data/lib/petsearch/pet.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
require 'date'
|
2
2
|
require 'json'
|
3
|
-
|
3
|
+
#require_relative '../petsearch'
|
4
4
|
|
5
5
|
class Pet
|
6
6
|
attr_accessor :name, :age, :sex, :size, :petfinder_id, :shelter_id, :images, :breeds, :status, :contact, :description, :last_update, :options
|
@@ -22,5 +22,9 @@ class Pet
|
|
22
22
|
end
|
23
23
|
|
24
24
|
|
25
|
+
# PetClient.get_token()
|
26
|
+
# PetSearch.init_options('sex=m', 'dog', 'senior', '94123', 'breeds=pug,vizsla', 'ct5', 'sm')
|
27
|
+
# binding.pry
|
28
|
+
|
25
29
|
|
26
30
|
end
|
data/lib/petsearch/petclient.rb
CHANGED
@@ -5,6 +5,7 @@ require 'nokogiri'
|
|
5
5
|
require 'date'
|
6
6
|
|
7
7
|
|
8
|
+
|
8
9
|
class PetClient
|
9
10
|
|
10
11
|
@@token_hash = Hash.new
|
@@ -12,6 +13,10 @@ class PetClient
|
|
12
13
|
def initialize
|
13
14
|
end
|
14
15
|
|
16
|
+
def self.token_hash
|
17
|
+
@@token_hash
|
18
|
+
end
|
19
|
+
|
15
20
|
def self.get_token
|
16
21
|
key_secret="#{ENV['PET_SECRET']}key=#{ENV['PET_KEY']}"
|
17
22
|
md5 = Digest::MD5.hexdigest(key_secret)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: PetSearch
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.7.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Lior Bendat, Sharif Hadidi
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-08-
|
11
|
+
date: 2013-08-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: nokogiri
|