binder_sdk 0.0.3 → 0.0.4

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: 8d7aeb75b09dd29776c4105b261a840cd7df729d
4
- data.tar.gz: 8d02ea08efd728193b79a46616364f8ce0bb2871
3
+ metadata.gz: b290ff942b64483a1f1d98f6601569b04819e91f
4
+ data.tar.gz: 52ffedb7be94b6c4b3fda4029df5a7fe51952262
5
5
  SHA512:
6
- metadata.gz: ddf9000463a356ed05d17ed9e102924ad4381e7df1d62bcfa3ec8f77e59c405a582b6724e1d29e73b81c4b3d0e348eea4b68a71da3a14ce1bb14e04a98fd0e4a
7
- data.tar.gz: ced39512b9b129b9d78d0bc8dd0054118d5ed1b2d382a9eda1f5c8e6f6f30b00c0bec9c4ca5b4e4d388a065839c93342d2a3d83b1b200a1b8e5217a2b0ec27da
6
+ metadata.gz: bda2cc791d0d99f5e11c4b724506edf1b36f178ca8873d86c395892d07c455323b71dc062d595a2d7c844bf40538e63f408261a79f7bcf9c192141c7c444e349
7
+ data.tar.gz: 87c4e7462a67374558c4482cb57e21df4ef966fe0ba146db102bab7b1dc5238747765d82a08f31b09362140373a0bdbc092f588121313c6c92884cb296cab647
data/CHANGELOG.md CHANGED
@@ -1,3 +1,6 @@
1
+ # 0.0.4 / 2014-06-13
2
+ * [FEATURE] Added entry and resource.
3
+
1
4
  # 0.0.3 / 2014-06-12
2
5
  * [FEATURE] Added name to user.
3
6
 
@@ -0,0 +1,29 @@
1
+ module BinderSDK
2
+ class Entry < SDKResource
3
+ self.path = "/entries"
4
+ end
5
+
6
+ def user
7
+ @user ||= User.find(user_id)
8
+ end
9
+
10
+ def resource
11
+ @resource ||= Resource.find(resource_id)
12
+ end
13
+
14
+ def binder
15
+ @binder ||= Binder.find(resource_id)
16
+ end
17
+
18
+ class EntryMock < Entry
19
+ extend Loquor::ResourceMock
20
+
21
+ self.attributes = {
22
+ id: 50,
23
+ user_id: 30660,
24
+ resource_id: 17,
25
+ binder_id: 11,
26
+ order_value: 100
27
+ }
28
+ end
29
+ end
@@ -0,0 +1,23 @@
1
+ module BinderSDK
2
+ class Resource < SDKResource
3
+ self.path = "/resources"
4
+
5
+ def entries
6
+ Entry.where(resource_id: self.id)
7
+ end
8
+
9
+ end
10
+
11
+ class ResourceMock < Resource
12
+ extend Loquor::ResourceMock
13
+
14
+ self.attributes = {
15
+ id: 1,
16
+ created_by_id: 1,
17
+ site_name: 'FooTube',
18
+ url: 'http://footube.example.com/foo/bar',
19
+ title: 'Foo Bar Baz',
20
+ description: 'The Foo Bar Baz mock external resource is a great FooTube video.'
21
+ }
22
+ end
23
+ end
@@ -1,5 +1,5 @@
1
1
  module BinderSDK
2
- class User < Resource
2
+ class User < SDKResource
3
3
  self.path = "/users"
4
4
  end
5
5
 
@@ -1,5 +1,5 @@
1
1
  module BinderSDK
2
- class Resource < Loquor::Resource
2
+ class SDKResource < Loquor::Resource
3
3
  include Helpers
4
4
 
5
5
  def self.spi_type=(type)
@@ -20,6 +20,8 @@ RESOURCES = %w{
20
20
  user
21
21
  }
22
22
 
23
+ require "binder_sdk/resources/entry"
24
+ require "binder_sdk/resources/resource"
23
25
  require "binder_sdk/resources/user"
24
26
  RESOURCES.each do |resource|
25
27
  require "binder_sdk/resources/#{resource}"
@@ -1,3 +1,3 @@
1
1
  module BinderSDK
2
- VERSION = "0.0.3"
2
+ VERSION = "0.0.4"
3
3
  end
data/lib/binder_sdk.rb CHANGED
@@ -6,7 +6,7 @@ require 'binder_sdk/configuration'
6
6
  require 'binder_sdk/mocker'
7
7
 
8
8
  require 'binder_sdk/helpers'
9
- require 'binder_sdk/resource'
9
+ require 'binder_sdk/sdk_resource'
10
10
  require 'binder_sdk/email_shortcodes'
11
11
 
12
12
  module BinderSDK
@@ -0,0 +1,10 @@
1
+ require_relative '../test_helper'
2
+ require_relative '../sdk_resource_test'
3
+
4
+ module BinderSDK
5
+ class EntryTest < SDKResourceTest
6
+ test_resource(Entry, '/entries')
7
+ end
8
+ end
9
+
10
+
@@ -0,0 +1,10 @@
1
+ require_relative '../test_helper'
2
+ require_relative '../sdk_resource_test'
3
+
4
+ module BinderSDK
5
+ class ResourceTest < SDKResourceTest
6
+ test_resource(Resource, '/resources')
7
+ end
8
+ end
9
+
10
+
@@ -1,8 +1,8 @@
1
1
  require_relative '../test_helper'
2
- require_relative '../resource_test'
2
+ require_relative '../sdk_resource_test'
3
3
 
4
4
  module BinderSDK
5
- class UserTest < ResourceTest
5
+ class UserTest < SDKResourceTest
6
6
  test_resource(User, '/users')
7
7
  end
8
8
  end
@@ -1,6 +1,6 @@
1
1
  require_relative 'test_helper'
2
2
  module BinderSDK
3
- class ResourceTest < Minitest::Test
3
+ class SDKResourceTest < Minitest::Test
4
4
  def self.test_resource(klass, url)
5
5
  define_method :klass do klass end
6
6
  define_method :url do url end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: binder_sdk
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jeremy Walker
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-06-12 00:00:00.000000000 Z
11
+ date: 2014-06-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -129,14 +129,18 @@ files:
129
129
  - lib/binder_sdk/email_shortcodes.rb
130
130
  - lib/binder_sdk/helpers.rb
131
131
  - lib/binder_sdk/mocker.rb
132
- - lib/binder_sdk/resource.rb
132
+ - lib/binder_sdk/resources/entry.rb
133
+ - lib/binder_sdk/resources/resource.rb
133
134
  - lib/binder_sdk/resources/user.rb
135
+ - lib/binder_sdk/sdk_resource.rb
134
136
  - lib/binder_sdk/version.rb
135
137
  - test/arbitary_test.rb
136
138
  - test/configuration_test.rb
137
139
  - test/mocker_test.rb
138
- - test/resource_test.rb
140
+ - test/resources/entry_test.rb
141
+ - test/resources/resource_test.rb
139
142
  - test/resources/user_test.rb
143
+ - test/sdk_resource_test.rb
140
144
  - test/test_helper.rb
141
145
  homepage: http://github.com/meducation/binder_sdk
142
146
  licenses:
@@ -166,6 +170,8 @@ test_files:
166
170
  - test/arbitary_test.rb
167
171
  - test/configuration_test.rb
168
172
  - test/mocker_test.rb
169
- - test/resource_test.rb
173
+ - test/resources/entry_test.rb
174
+ - test/resources/resource_test.rb
170
175
  - test/resources/user_test.rb
176
+ - test/sdk_resource_test.rb
171
177
  - test/test_helper.rb