PetSearch 0.0.7.7 → 0.0.7.8

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 CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- ZjlmYTIzNDVhMzUwNDc1NWFiMDM1YWFkMGI1NDY4NjQ2OGY5MDM5MA==
4
+ ZGYwN2Q0ZjU5YmJjZDhjNmI4Y2MzMGU4M2E2ZGE3ZjRhMGEzMjg1ZA==
5
5
  data.tar.gz: !binary |-
6
- OTdlZTA4MTMyYjY1ZGM4ZDZiMzA3YmM3YmRmODkxZGFlMTg2MDZhMQ==
6
+ NTE5MGE4NThlMzFhZWRiYWQwYzA3NGM4MTQyOWUxYWRmM2FmMjNmMA==
7
7
  !binary "U0hBNTEy":
8
8
  metadata.gz: !binary |-
9
- Y2I3M2YxYTcwZWMwYmM5ZDA2MDc5NmEyZWUxNmExZmEyNDlkOWJmZGQwYjZk
10
- YWJmNmJhNWYwNjk5MTRjMGRhZmFjMDg0NjE0MzRmMDg0ZThhMjQwNTM4MTA0
11
- M2MwOWExMTczYWMyOTE4N2Q5NmFlM2M3YjJiOTZiZjcwMDYxZmI=
9
+ MGJhNTE1NzQ4MWI5ZjQ3ZmViZGJjNTE2ZDcyNjIwZmExY2YyMDc2NjgxYTBj
10
+ MTZlZThiOWNmNTA0YTNhMGU1NmE4YWRiOTQyODY2OGE0NTQyMDNlYmY3MDkx
11
+ YjNkMTU1M2RjZmU1MzgxNjAzNDI5NjhhZWJkMTgzMDQwMmJhNTI=
12
12
  data.tar.gz: !binary |-
13
- ZGM2NjY5OTJjYjcwOGRjY2U1YTJhOTM3NDEyNTA1OTlkMDY3NTBiZTg0YTRm
14
- YWRlOTdjNzcwOWVkM2E1Y2RlMzQ0YTA5MjYyOTRlMjdiMWUyODRiYmQ2NWZk
15
- YTg5MDI4ZWRkYTk2MDJmNDQ3ZTlmYjhlZWZjZGM5YWMyYTA3Njg=
13
+ NGE1ZDVkOWNkMmUzMDJmYmIwM2Y5YjRkOTVmMDk2MjhiOGUwZDg5ZTY3ZWZl
14
+ Nzk3ZDJmNmQzOGZmY2NiZjI1ODQwMGE1MjM5YjQ2ZmZlMjEyNGI4NjVmMDM1
15
+ ZmYyNmI3NWU4Mjc2MjE0ZDliNjRjYWM3MWNiNGFmNjE2OGU5Yjk=
@@ -9,7 +9,6 @@ require 'petsearch/pet'
9
9
 
10
10
  class PetSearch
11
11
  attr_accessor :dog, :cat, :bird, :reptile, :horse, :pig, :barnyard, :smallfurry
12
- @@options = Hash.new
13
12
  def initialize
14
13
  @dog = {:name => 'dog', :breeds => []}
15
14
  @cat = {:name => 'cat', :breeds => []}
@@ -43,7 +42,7 @@ class PetSearch
43
42
  end
44
43
  @@options[:random] = args.grep(/[Tt]rue|[Ff]alse/).first
45
44
  @@options[:offset] = args.grep(/[Oo]ff/).first.downcase.match(/(?<=off).*/)[0] if args.grep(/[Oo]ff/).first
46
- @@options[:count] = args.grep(/[Ct]/).first.downcase.match(/(?<=ct).*/)[0] if args.grep(/[Ct]/).first
45
+ @@options[:count] = args.grep(/[Cc]t/).first.downcase.match(/(?<=ct).*/)[0] if args.grep(/[Cc]t/).first
47
46
  rescue NoMethodError
48
47
  puts "You have an error in your parameters"
49
48
  end
@@ -50,8 +50,11 @@ class Pet
50
50
  p = Pet.new
51
51
  if pet['options']['option'].class == Hash
52
52
  p.options << pet['options']['option']['$t']
53
- else p.options = pet['options']['option'].map { |t|
53
+ elsif pet['options']['option'].class == Array
54
+ p.options = pet['options']['option'].map { |t|
54
55
  t['$t'] }
56
+ else
57
+ p.options = []
55
58
  end
56
59
  if pet['breeds']['breed'].class == Hash
57
60
  p.options << pet['breeds']['breed']['$t']
@@ -75,9 +78,13 @@ class Pet
75
78
  p.size = pet['size']['$t']
76
79
  p.age = pet['age']['$t']
77
80
  p.last_update = Date.parse((pet['lastUpdate']['$t'].split('T'))[0])
78
- p.images = pet['media']['photos']['photo'].map { |photo|
79
- photo['$t']
80
- }
81
+ if (pet['media']['photos'].class == Array || pet['media']['photos'].class==Hash)
82
+ p.images = pet['media']['photos']['photo'].map { |photo|
83
+ photo['$t']
84
+ }
85
+ else
86
+ p.images = []
87
+ end
81
88
  p.petfinder_id = pet['id']['$t']
82
89
  @@pets << p
83
90
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: PetSearch
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.7.7
4
+ version: 0.0.7.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Lior Bendat, Sharif Hadidi