wangiry 0.0.3 → 0.0.4

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: a63d685142f25247dba4314a2cc4328e1abeb83b
4
- data.tar.gz: ff8187e94fc31c23e3bf14ccc747b168b4f43764
3
+ metadata.gz: 18225857d9e60d77bd679bcccd515c2ad2ae0d04
4
+ data.tar.gz: 7f6d014b01263a83bde315189d0e2c0ae9a213c5
5
5
  SHA512:
6
- metadata.gz: 001dc9584dd050a16502d81b2017e482be1d01b407064e537088bdf5484f1401e8e07b81f545a7441f5ce61c96b1468c51f3c32acab290b94ab2e0754015569e
7
- data.tar.gz: 44eceb2a36f47b782854df1866a0ce25c7d579e912ffbabdd69cd44ac0b395887362f09fe07c03a53593a04747c83393f2b2f509e371b2c0be16bf3df0917caf
6
+ metadata.gz: 3a9ac029d95ccf1b7ce4f9af5c106d6450d09a6468cc175ba4d8aa61605ec84fb40bdec9850445b2b14c362695b9e40ad5f5aeba6a225704a81f8d3fb760e49d
7
+ data.tar.gz: 908a4b5608a7894e9e73c298b6606b930f0898db70d251920202ad329888567b2057ba8ed55fd56271d016d630874dbfe70528b84c4847991e9675fe7a85e064
data/.gitignore CHANGED
@@ -16,3 +16,4 @@ test/tmp
16
16
  test/version_tmp
17
17
  tmp
18
18
  vendor/bundle/
19
+ /nbproject/private/
data/README.md CHANGED
@@ -20,10 +20,13 @@ Or install it yourself as:
20
20
 
21
21
  http://kddi-web.twilio.jp/ (Japanese)
22
22
 
23
- ### write setting file
23
+ ### settings
24
+
25
+ #### pattern1. write setting file
24
26
 
25
27
  setting file(json file) save your favolite path!
26
28
 
29
+ example
27
30
  ````js
28
31
  {
29
32
  "ACCOUNT_SID": "xxxx",
@@ -41,14 +44,35 @@ setting file(json file) save your favolite path!
41
44
  - some URL(RECOMMEND: your website): URL
42
45
  - calling time(sec): CALLING_TIME
43
46
 
47
+ #### pattern2.
48
+
49
+ set env
50
+
51
+ ````sh
52
+ export WANGIRY_ACCOUNT_SID=xxxx
53
+ export WANGIRY_AUTH_TOKEN=xxxx
54
+ export WANGIRY_FROM_NUMBER='+xxx'
55
+ export WANGIRY_TO_NUMBER='+xxx'
56
+ export WANGIRY_URL='http://example.com'
57
+ export WANGIRY_CALLING_TIME=x
58
+ ````
59
+
44
60
  ## Usage
45
61
 
62
+ ### pattern1
46
63
  ````sh
47
64
  wangiry SETTING_FILE
48
65
  ````
49
66
 
50
67
  ARGV.first: your setting file
51
68
 
69
+ ### pattern2
70
+
71
+ ````sh
72
+ wangiry
73
+ ````
74
+ use settings in env
75
+
52
76
  ## Contributing
53
77
 
54
78
  1. Fork it
data/bin/wangiry CHANGED
@@ -1,13 +1,20 @@
1
1
  #!/usr/bin/env ruby
2
- require_relative '../lib/wangiry'
2
+ require 'wangiry'
3
3
  require 'json'
4
4
 
5
- if ARGV.size.zero?
5
+ if ARGV.first == '--help'
6
6
  STDERR.puts "usage: #{__FILE__} SETTING_FILE"
7
7
  STDERR.puts "How to write SETTING_FILE: see https://github.com/bash0C7/wangiry#write-setting-file"
8
8
  exit 1
9
9
  end
10
10
 
11
- setting = JSON.parse(File.read(ARGV.shift))
12
- Wangiry.call setting['ACCOUNT_SID'], setting['AUTH_TOKEN'], setting['FROM_NUMBER'], setting['TO_NUMBER'], setting['URL'], setting['CALLING_TIME']
11
+ setting = JSON.parse(File.read(ARGV.shift)) unless ARGV.size.zero?
12
+ setting ||= {}
13
+ setting['ACCOUNT_SID'] ||= ENV['WANGIRY_ACCOUNT_SID']
14
+ setting['AUTH_TOKEN'] ||= ENV['WANGIRY_AUTH_TOKEN']
15
+ setting['FROM_NUMBER'] ||= ENV['WANGIRY_FROM_NUMBER']
16
+ setting['TO_NUMBER'] ||= ENV['WANGIRY_TO_NUMBER']
17
+ setting['URL'] ||= ENV['WANGIRY_URL']
18
+ setting['CALLING_TIME'] ||= ENV['WANGIRY_CALLING_TIME']
13
19
 
20
+ Wangiry.call setting['ACCOUNT_SID'].to_s, setting['AUTH_TOKEN'].to_s, setting['FROM_NUMBER'].to_s, setting['TO_NUMBER'].to_s, setting['URL'].to_s, setting['CALLING_TIME'].to_i
@@ -1,3 +1,3 @@
1
1
  module Wangiry
2
- VERSION = "0.0.3"
2
+ VERSION = "0.0.4"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: wangiry
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
  - bash0C7
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-04-22 00:00:00.000000000 Z
11
+ date: 2013-04-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: twilio-ruby