biller_bot_resource 0.0.7 → 0.0.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 ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 312e9855ea60c8d90d114c01e549aaa8438f5cc7
4
+ data.tar.gz: 2c020114cbb0a01043fc8256875f375a9c1a5673
5
+ SHA512:
6
+ metadata.gz: 0c4effb74383dbd5991f7994d8f1efb6c2a0139a2c19b26ed780b3810b2407dea0cf61b1ba35469a317ae2b89bf2bb0dd26a5557edeb006a6bb239501c96ca6c
7
+ data.tar.gz: 7e7cd2693fc64b59f31e2f3687a8f18ee0b504f0f3f40550327c167469d54e9681787c4a682bbcf6b8b802ebd85414f714da708550ba543597b23e46a17d0009
@@ -1,3 +1,42 @@
1
1
  class BillerBotResource::Product < BillerBotResource::Resource
2
-
2
+
3
+ class Context < BillerBotResource::Resource
4
+ self.prefix = "/products/:product_id/"
5
+
6
+ attr_accessor :product_id
7
+
8
+ def prefix_options
9
+ { :product_id => product_id }
10
+ end
11
+
12
+ ##
13
+ # ActiveResource treats our nested models as non-persisted models. We make
14
+ # this little hack so that the contexts can be loaded with the product, but
15
+ # saved independently.
16
+ def force_persisted
17
+ @persisted = true
18
+ end
19
+ end
20
+
21
+ def initialize(*args)
22
+ super
23
+ contexts.each do |c|
24
+ c.product_id = id
25
+ c.force_persisted # See comments on method
26
+ end
27
+ end
28
+
29
+ def contexts
30
+ @attributes[:contexts] ||= []
31
+ @attributes[:contexts]
32
+ end
33
+
34
+ ##
35
+ # Fetch the root product context for the given account ID.
36
+ #
37
+ # @param [Integer] account_id
38
+ # @return [BillerBotResource::ProductContext|nil]
39
+ def root_context_for_account_id(account_id)
40
+ contexts.select { |c| c.type == "AccountProductContext" && c.account_id == account_id }.first
41
+ end
3
42
  end
@@ -1,3 +1,3 @@
1
1
  module BillerBotResource
2
- VERSION = "0.0.7"
2
+ VERSION = "0.0.8"
3
3
  end
metadata CHANGED
@@ -1,33 +1,22 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: biller_bot_resource
3
- version: !ruby/object:Gem::Version
4
- prerelease: false
5
- segments:
6
- - 0
7
- - 0
8
- - 7
9
- version: 0.0.7
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.8
10
5
  platform: ruby
11
- authors:
6
+ authors:
12
7
  - Brad Seefeld
13
8
  autorequire:
14
9
  bindir: bin
15
10
  cert_chain: []
16
-
17
- date: 2013-12-15 00:00:00 -08:00
18
- default_executable:
11
+ date: 2013-12-23 00:00:00.000000000 Z
19
12
  dependencies: []
20
-
21
13
  description: Provides a set of Ruby classes for interacting with the BillerBot API
22
- email:
14
+ email:
23
15
  - support@dispatchbot.com
24
16
  executables: []
25
-
26
17
  extensions: []
27
-
28
18
  extra_rdoc_files: []
29
-
30
- files:
19
+ files:
31
20
  - .gitignore
32
21
  - Gemfile
33
22
  - README.md
@@ -42,35 +31,27 @@ files:
42
31
  - lib/biller_bot_resource/product.rb
43
32
  - lib/biller_bot_resource/resource.rb
44
33
  - lib/biller_bot_resource/version.rb
45
- has_rdoc: true
46
34
  homepage: https://github.com/bradseefeld/biller_bot_resource
47
35
  licenses: []
48
-
36
+ metadata: {}
49
37
  post_install_message:
50
38
  rdoc_options: []
51
-
52
- require_paths:
39
+ require_paths:
53
40
  - lib
54
- required_ruby_version: !ruby/object:Gem::Requirement
55
- requirements:
56
- - - ">="
57
- - !ruby/object:Gem::Version
58
- segments:
59
- - 0
60
- version: "0"
61
- required_rubygems_version: !ruby/object:Gem::Requirement
62
- requirements:
63
- - - ">="
64
- - !ruby/object:Gem::Version
65
- segments:
66
- - 0
67
- version: "0"
41
+ required_ruby_version: !ruby/object:Gem::Requirement
42
+ requirements:
43
+ - - '>='
44
+ - !ruby/object:Gem::Version
45
+ version: '0'
46
+ required_rubygems_version: !ruby/object:Gem::Requirement
47
+ requirements:
48
+ - - '>='
49
+ - !ruby/object:Gem::Version
50
+ version: '0'
68
51
  requirements: []
69
-
70
52
  rubyforge_project: biller_bot_resource
71
- rubygems_version: 1.3.6
53
+ rubygems_version: 2.1.11
72
54
  signing_key:
73
- specification_version: 3
55
+ specification_version: 4
74
56
  summary: Common resources for the BillerBot API
75
57
  test_files: []
76
-