misoca_ruby_client 0.1.1 → 0.1.2

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,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 3cc7cfa222e16a85930d9cd252efae86d9e8f306
4
- data.tar.gz: 8564097519208db3f7171a84791e1ec3ab8dfe33
3
+ metadata.gz: 9024b01408b90ac66745f272e4b979aa8fdaebf2
4
+ data.tar.gz: c2ca97ed187ed7d0a2c6fef18c5fe117ca5af2c6
5
5
  SHA512:
6
- metadata.gz: 93c21ffe520269f455ca3ad6967b31e820203a66f8081fcbdc00ef1fa038d38ce9e8ef5fa8c0ffb684a232741a0a48ea4cb9988dce4f7e57bf426de5afc433c0
7
- data.tar.gz: 3301d0ff4277bb7af3e03f32e04ef67eef95eaf7afce21feda31d9634d486ef5e4d33731d612de474cc672349c199b24e53c244dd87ae06d3e70b71ec7b8c41d
6
+ metadata.gz: 020b15dc82cd1a64ddb9b2061849f6d39187930a93ad95864c45d0db2e7d1b00b76ae457b81d5f0b97e71e761e1adf254e82e659ef6e838b5a9acc2574897118
7
+ data.tar.gz: 94240c0abff4d7a4f0211866445bfe0bde862abe3366e48348d72031e1bac04a02dfe2a8c29da687b568dcd0025eb147b56031b499f1af886d76a7009f4cc8ef
data/README.md CHANGED
@@ -10,7 +10,7 @@ gem 'misoca_ruby_client'
10
10
 
11
11
  And then execute:
12
12
 
13
- $ bundle
13
+ $ bundle instal
14
14
 
15
15
  Or install it yourself as:
16
16
 
@@ -18,29 +18,32 @@ Or install it yourself as:
18
18
 
19
19
  ## Usage
20
20
 
21
- Because misoca's refresh token live quite a long time. You can save your token somewhere and constantly refresh the token(e.g. Cron) so you don't have to do oath everytime.
22
- ```
21
+ Because misoca's refresh token live quite a long time. You can save your token somewhere and constantly refresh the token(e.g. Cron) so you don't have to authorize everytime.
22
+ ```ruby
23
23
  # Create a proc so that we can save the token to somewhere
24
- update_config = Proc.new { |access_token|
24
+ update_config = proc { |access_token|
25
25
  SomeModelToSaveToken.update_columns(misoca_access_token: access_token.token, misoca_refresh_token: access_token.refresh_token)
26
26
  }
27
+
27
28
  # Initialize client
28
29
  mymisoca = MisocaRubyClient.new(application_id, secret, callback_url, update_config)
30
+
29
31
  # Inject a saved token so that you can skip authentication
30
32
  mymisoca.inject_access_token(misoca_access_token, misoca_refresh_token) if misoca_access_token && misoca_refresh_token
31
33
  ```
32
34
  Then you can have a cron which do
33
- ```
35
+ ```ruby
34
36
  mymisoca.refresh_access_token
35
37
  ```
36
38
  at least once everyday.
37
39
 
38
40
  You can also choose not using `update_config`. For this, you need a callback controller which do.
39
- ```
41
+ ```ruby
40
42
  class OauthController < ApplicationController
41
43
  def misoca_authorization
42
44
  return redirect_to mymisoca.get_authorize_url
43
45
  end
46
+
44
47
  def misoca_callback
45
48
  mymisoca.exchange_token(params[:code])
46
49
  return redirect_to "/configs"
@@ -50,7 +53,7 @@ end
50
53
  Note that `misoca_authorization` redirect you to Misoca's oauth page. `misoca_callback` is the callback which receive `params[:code]` and update access token.
51
54
 
52
55
  Create an invoice
53
- ```
56
+ ```ruby
54
57
  invoice = {
55
58
  issue_date: Date.today,
56
59
  payment_due_on: Date.today,
@@ -1,3 +1,3 @@
1
1
  module MisocaRubyClient
2
- VERSION = "0.1.1"
2
+ VERSION = "0.1.2"
3
3
  end
@@ -11,7 +11,7 @@ Gem::Specification.new do |spec|
11
11
 
12
12
  spec.summary = %q{A client lib for Misoca.}
13
13
  spec.description = %q{This client lib allow you to save/inject access token.}
14
- spec.homepage = "https://github.com/hokichaio/misoca-ruby-client."
14
+ spec.homepage = "https://github.com/hokichaio/misoca_ruby_client"
15
15
  spec.license = "MIT"
16
16
 
17
17
  spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: misoca_ruby_client
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kevin Tsai
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2016-06-22 00:00:00.000000000 Z
11
+ date: 2016-06-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: oauth2
@@ -87,7 +87,7 @@ files:
87
87
  - lib/misoca_ruby_client/client.rb
88
88
  - lib/misoca_ruby_client/version.rb
89
89
  - misoca_ruby_client.gemspec
90
- homepage: https://github.com/hokichaio/misoca-ruby-client.
90
+ homepage: https://github.com/hokichaio/misoca_ruby_client
91
91
  licenses:
92
92
  - MIT
93
93
  metadata: {}