hound_breeder 0.0.2 → 0.0.3

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,7 +1,15 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 9c22558bdbac5f5200273ff76613b989a169d1bc
4
- data.tar.gz: 30b512fc0da4e48af568fe0d4dbc877dba572eb0
2
+ !binary "U0hBMQ==":
3
+ metadata.gz: !binary |-
4
+ OTI5Mzg1YTIzNDg2MGVmMjM1ZGU1MzAwNjM2YjJiMDFkYmY1ZjZiOQ==
5
+ data.tar.gz: !binary |-
6
+ YmVjZWMwMGNkYjI3ZmY5MzEzNTA1NDY2MmEzNDQwNDRkMjU4YmExMw==
5
7
  SHA512:
6
- metadata.gz: 7635791c602773082c053bca36e6b954933796d7bcdaa35e4ddccf4e95f9ddb845e85b3705e9b7f40a213c3c96e36443bb5b9d7c79658fe25c7a07b5eb3e68ba
7
- data.tar.gz: 7ce488c27fcd9e3366992e1ba4b329c7a151f89af5ad558195394e4b24d401a09a5544604444eb1e0e69365a143a1b34abb7ce753be60fdc2e9d19d3ed99cfea
8
+ metadata.gz: !binary |-
9
+ ZGVhYzhhM2VlMjZmMGEwOTQ2NzZlZTdmYWRhNGM3NTAyZmE1OTVlZjY2ZTdh
10
+ ZWM2YWE4MjIxMjQyMDZlZDcyMTM5ZjEwNzEzMzkwNDFkZDE2YjE1MDVhNjhj
11
+ ZDZkNzAyNmYzM2I4OGQ2MmY2ZmExZGIzN2FjYzdkOTE5NjI3ZDQ=
12
+ data.tar.gz: !binary |-
13
+ NDk2OGExZDQ5ZDE0MjdkNWI3NzExNGMyZjYwZjlhOTRkNjc5Y2UxYTBkZjg5
14
+ ODQxYjg1NWM1ODg0ODEwZjA5ZDgyMWQ2ODEwZWU4MjMwYTE3NjVmMzU0NTM2
15
+ MzMyOWRlOGVmMTBkM2UyM2E0ZDUzNWIwYjdjZWYxOWVlZmRlYjc=
@@ -1,62 +1,66 @@
1
- # https://github.com/thoughtbot/hound/blob/master/app/assets/javascripts/directives/repo.js.coffee.erb
2
1
  App.directive 'repo', ['Subscription', 'StripeCheckout', (Subscription, StripeCheckout) ->
3
2
  scope: true
4
3
  templateUrl: '/templates/repo'
5
4
  link: (scope, element, attributes) ->
6
- repo = scope.repo
7
- scope.processing = false
8
-
9
- activate = ->
10
- repo.$activate()
11
- .then(->
12
- scope.processing = false
13
- ).catch(-> alert('Your repo failed to activate.'))
14
-
15
- deactivate = ->
16
- repo.$deactivate()
17
- .then(-> scope.processing = false)
5
+ activateRepo = ->
6
+ scope.processing = true
7
+
8
+ scope.repo.$activate()
9
+ .catch(-> alert('Your repo failed to activate.'))
10
+ .finally(-> scope.processing = false)
11
+
12
+ deactivateRepo = ->
13
+ scope.processing = true
14
+
15
+ scope.repo.$deactivate()
18
16
  .catch(-> alert('Your repo failed to deactivate.'))
17
+ .finally(-> scope.processing = false)
19
18
 
20
19
  createSubscription = (stripeToken) ->
21
20
  scope.processing = true
22
21
 
23
22
  subscription = new Subscription(
24
- repo_id: repo.id
23
+ repo_id: scope.repo.id
25
24
  card_token: stripeToken.id
26
25
  email_address: stripeToken.email
27
26
  )
28
27
 
29
- subscription.$save().then(->
28
+ subscription.$save().then((response) ->
29
+ scope.repo.active = true
30
+ scope.repo.stripe_subscription_id = response.stripe_subscription_id
31
+ ).catch(->
32
+ alert('Your subscription failed.')
33
+ ).finally(->
30
34
  scope.processing = false
31
- repo.active = true
32
- , ->
35
+ )
36
+
37
+ deleteSubscription = ->
38
+ scope.processing = true
39
+
40
+ subscription = new Subscription(repo_id: scope.repo.id)
41
+
42
+ subscription.$delete().then(->
43
+ scope.repo.active = false
44
+ scope.repo.stripe_subscription_id = null
45
+ ).catch(->
46
+ alert('Your repo could not be disabled')
47
+ ).finally(->
33
48
  scope.processing = false
34
- alert('Your subscription failed.')
35
49
  )
36
50
 
37
51
  scope.toggle = ->
38
- if repo.active
39
- if repo.stripe_subscription_id
40
- scope.processing = true
41
- subscription = new Subscription(repo_id: repo.id)
42
- subscription.$delete().then(->
43
- repo.active = false
44
- scope.processing = false
45
- , ->
46
- alert('Your repo could not be disabled')
47
- scope.processing = false
48
- )
52
+ if scope.repo.active
53
+ if scope.repo.stripe_subscription_id
54
+ deleteSubscription()
49
55
  else
50
- scope.processing = true
51
- deactivate(repo)
56
+ deactivateRepo()
52
57
  else
53
- # if repo.private
58
+ # if scope.repo.private
54
59
  # StripeCheckout.open(
55
- # name: repo.full_plan_name,
56
- # amount: repo.price_in_cents,
60
+ # name: scope.repo.full_plan_name,
61
+ # amount: scope.repo.price_in_cents,
57
62
  # createSubscription
58
63
  # )
59
64
  # else
60
- scope.processing = true
61
- activate(repo)
65
+ activateRepo()
62
66
  ]
@@ -1,3 +1,3 @@
1
1
  module HoundBreeder
2
- VERSION = '0.0.2'
2
+ VERSION = '0.0.3'
3
3
  end
metadata CHANGED
@@ -1,41 +1,41 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hound_breeder
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Masahiro Saito
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-09-20 00:00:00.000000000 Z
11
+ date: 2014-09-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - ">="
17
+ - - ! '>='
18
18
  - !ruby/object:Gem::Version
19
19
  version: '0'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - ">="
24
+ - - ! '>='
25
25
  - !ruby/object:Gem::Version
26
26
  version: '0'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: pry
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - ">="
31
+ - - ! '>='
32
32
  - !ruby/object:Gem::Version
33
33
  version: '0'
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - ">="
38
+ - - ! '>='
39
39
  - !ruby/object:Gem::Version
40
40
  version: '0'
41
41
  description: This gem updates Hound for OSS. Don't open purchase window
@@ -45,7 +45,7 @@ executables: []
45
45
  extensions: []
46
46
  extra_rdoc_files: []
47
47
  files:
48
- - ".gitignore"
48
+ - .gitignore
49
49
  - Gemfile
50
50
  - MIT-LICENSE
51
51
  - README.md
@@ -66,19 +66,18 @@ require_paths:
66
66
  - lib
67
67
  required_ruby_version: !ruby/object:Gem::Requirement
68
68
  requirements:
69
- - - ">="
69
+ - - ! '>='
70
70
  - !ruby/object:Gem::Version
71
71
  version: '0'
72
72
  required_rubygems_version: !ruby/object:Gem::Requirement
73
73
  requirements:
74
- - - ">="
74
+ - - ! '>='
75
75
  - !ruby/object:Gem::Version
76
76
  version: '0'
77
77
  requirements: []
78
78
  rubyforge_project:
79
- rubygems_version: 2.2.2
79
+ rubygems_version: 2.4.1
80
80
  signing_key:
81
81
  specification_version: 4
82
82
  summary: This gem updates Hound for OSS. Don't open purchase window
83
83
  test_files: []
84
- has_rdoc: