teamsnap_rb 0.0.7 → 0.0.8

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 386562e820e675cef97c66d5b22804bfd20ae626
4
- data.tar.gz: fdea3d3e62bcccff199ece97232569142abef828
3
+ metadata.gz: b7d2fa31f938ab3823bb36c4c6d1717afe5f88a1
4
+ data.tar.gz: d2573216d36f51ed5d9c791fbafaac27729e7f5e
5
5
  SHA512:
6
- metadata.gz: 8a9444f3b2e4afe4f920701f3114842fa36f233511f9a4e0b00dbdc217b51879190e0b8a99a211f3fae1b8ee9d0232bd0ac102f5060b9b2758fb1745a4b499f1
7
- data.tar.gz: 2e485eae3d4d3ca5fb87b81984b1a2b0dd963ba603a95e23a3710c2c3babe44c2cd1eb4aa9c15b389c01f591a1f77367ccf63b505bf234e7e9a08960f556a655
6
+ metadata.gz: 37202379f9ec80a10cc4e351c419962b3db2094077a33cfc7ecbd29aa0cc6d8473afeed3640b68453b1004439a48e5582864b32f20d8c817474d48a4b277fcd0
7
+ data.tar.gz: 44c0684500659687b8e230ebbd844b941970e42a86cd506b7ab46b149a87cf0df2c81191fa18775358d2f9e1ce84e428a3a0c9bdcf4d50fdec57e23a1a67711d
@@ -1,6 +1,6 @@
1
1
  module TeamsnapRb
2
2
  class Client < Collection
3
- def initialize(url = "https://apiv3.teamsnap.com/", options = {})
3
+ def initialize(url = "https://api.teamsnap.com/v3/", options = {})
4
4
  config = options.fetch(:config, Config.new)
5
5
  super(url, {}, config)
6
6
  end
@@ -95,6 +95,18 @@ module TeamsnapRb
95
95
  errors.count > 0
96
96
  end
97
97
 
98
+ def size
99
+ items.size
100
+ end
101
+
102
+ def present?
103
+ items.size > 0
104
+ end
105
+
106
+ def blank?
107
+ items.size == 0
108
+ end
109
+
98
110
  private
99
111
 
100
112
  attr_accessor :collection_json, :config, :items, :url
@@ -135,6 +147,18 @@ module TeamsnapRb
135
147
  end
136
148
  end
137
149
 
150
+ def size
151
+ items.size
152
+ end
153
+
154
+ def present?
155
+ items.size > 0
156
+ end
157
+
158
+ def blank?
159
+ items.size == 0
160
+ end
161
+
138
162
  def where(attribute_hash)
139
163
  CollectionWhereProxy.new(find_all do |item|
140
164
  attribute_hash.keys.all? do |key|
@@ -1,3 +1,3 @@
1
1
  module TeamsnapRb
2
- VERSION = "0.0.7"
2
+ VERSION = "0.0.8"
3
3
  end
@@ -66,6 +66,24 @@ describe TeamsnapRb::Collection do
66
66
  expect(root_collection.error?).to eq(false)
67
67
  end
68
68
  end
69
+
70
+ describe "size" do
71
+ it "returns zero when there are no items" do
72
+ expect(root_collection.size).to eq(0)
73
+ end
74
+ end
75
+
76
+ describe "present?" do
77
+ it "returns false when there are no iteams" do
78
+ expect(root_collection.present?).to eq(false)
79
+ end
80
+ end
81
+
82
+ describe "blank?" do
83
+ it "returns true when there are no iteams" do
84
+ expect(root_collection.blank?).to eq(true)
85
+ end
86
+ end
69
87
  end
70
88
 
71
89
  context "GET /teams/1", :vcr, record: :once do
@@ -106,6 +124,24 @@ describe TeamsnapRb::Collection do
106
124
  end
107
125
  end
108
126
 
127
+ describe "size" do
128
+ it "returns zero when there are no items" do
129
+ expect(team_collection.size).to eq(1)
130
+ end
131
+ end
132
+
133
+ describe "present?" do
134
+ it "returns true when there are no iteams" do
135
+ expect(team_collection.present?).to eq(true)
136
+ end
137
+ end
138
+
139
+ describe "blank?" do
140
+ it "returns false when there are no iteams" do
141
+ expect(team_collection.blank?).to eq(false)
142
+ end
143
+ end
144
+
109
145
  describe "#where" do
110
146
  it "returns a CollectionWhereProxy" do
111
147
  expect(team_collection.where({})).to be_a(TeamsnapRb::Collection::CollectionWhereProxy)
@@ -2,7 +2,7 @@
2
2
  http_interactions:
3
3
  - request:
4
4
  method: get
5
- uri: https://apiv3.teamsnap.com/
5
+ uri: https://api.teamsnap.com/v3/
6
6
  body:
7
7
  encoding: US-ASCII
8
8
  string: ''
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: teamsnap_rb
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.7
4
+ version: 0.0.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Party Chicken
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-01-16 00:00:00.000000000 Z
11
+ date: 2015-01-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler