bfon_builder 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: b1158dc1a3ef6198cf1bb3f25bd94919eda4787c
4
+ data.tar.gz: 2305d40805480f51e55dde19aa9b66ae88bb17d0
5
+ SHA512:
6
+ metadata.gz: c682ac7cc1aaf8af7c7124f1e358840c565a7c42d0e145ab64cb7eb4a37944eed5b769e483dbce166b18e3129a870ab667b0d05e08f1493022830a0effc7d421
7
+ data.tar.gz: 7436feea7bfa5388f07b5db8832f255205a6ed0df547eb20ed7f40c28c4ede62f9079ac35ff00dd3460cf3c95b228057870080fb45d7b3deac36fa4227df9311
data/.gitignore ADDED
@@ -0,0 +1,11 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /Gemfile.lock
4
+ /_yardoc/
5
+ /coverage/
6
+ /doc/
7
+ /pkg/
8
+ /spec/reports/
9
+ /tmp/
10
+ .idea/
11
+ *.gem
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in bfon_builder.gemspec
4
+ gemspec
data/README.md ADDED
@@ -0,0 +1,72 @@
1
+ # BulutfonXM Json Builder
2
+
3
+ ## Installation
4
+
5
+ Add this line to your application's Gemfile:
6
+
7
+ ```ruby
8
+ gem 'bfon_builder'
9
+ ```
10
+
11
+ And then execute:
12
+
13
+ $ bundle
14
+
15
+ Or install it yourself as:
16
+
17
+ $ gem install bfon_builder
18
+
19
+
20
+ ###Usage
21
+
22
+ You can chain methods.
23
+
24
+ ```ruby
25
+
26
+ bfxm = BfonBuilder.new;
27
+
28
+ bfxm.play('http://bfxmdemo.bulutfon.com/demosesler/demo-hosgeldiniz.mp3')
29
+ .dial(10)
30
+ .build;
31
+ ```
32
+ By default build() will return below code if you want to set json header and output below code just use build(true).
33
+
34
+ ```json
35
+ {
36
+ "bfxm": {
37
+ "version": 1
38
+ },
39
+ "seq": [
40
+ {
41
+ "action": "play",
42
+ "args": {
43
+ "url": "http://bfxmdemo.bulutfon.com/demosesler/demo-hosgeldiniz.mp3"
44
+ }
45
+ },
46
+ {
47
+ "action": "dial",
48
+ "args": {
49
+ "destination": 10
50
+ }
51
+ }
52
+ ]
53
+ }
54
+
55
+ ```
56
+
57
+
58
+ ###Methods
59
+
60
+ * play($url)
61
+
62
+ * gather
63
+
64
+ * hangup
65
+
66
+ * reject
67
+
68
+ * set_caller
69
+
70
+ * say
71
+
72
+ * dial
data/Rakefile ADDED
@@ -0,0 +1 @@
1
+ require 'bundler/gem_tasks'
@@ -0,0 +1,25 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'bfon_builder/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = 'bfon_builder'
8
+ spec.version = BfonBuilder::VERSION
9
+ spec.authors = ['hamitturkukaya']
10
+ spec.email = ['dev@bulutfon.com']
11
+
12
+ spec.summary = '%q{This is a gem for easy bfon string generator for ruby}'
13
+ spec.description = '%q{You can generate bfon objects with simple method calls}'
14
+ spec.homepage = 'https://github.com/bulutfon/ruby-bfon-builder'
15
+ spec.license = 'MIT'
16
+
17
+ spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features|bin)/}) }
18
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
19
+ spec.require_paths = ['lib']
20
+
21
+
22
+ spec.add_development_dependency 'bundler', '~> 1.9'
23
+ spec.add_development_dependency 'rake', '~> 10.0'
24
+ spec.add_dependency 'json', '~> 1.8'
25
+ end
@@ -0,0 +1,3 @@
1
+ module BfonBuilder
2
+ VERSION = '0.1.0'
3
+ end
@@ -0,0 +1,46 @@
1
+ require 'json'
2
+
3
+ class BfonBuilder
4
+ attr_reader :bfon
5
+
6
+ def initialize
7
+ @bfon = {bfxm: {version: 1}}
8
+ end
9
+
10
+ def play(url)
11
+ add({action: :play, args: {url: url}})
12
+ end
13
+
14
+ def gather(params = {})
15
+ add(action: :gather, args: params)
16
+ end
17
+
18
+ def hangup
19
+ add(action: :hangup)
20
+ end
21
+
22
+ def set_caller(name)
23
+ add(action: :set_caller_name, args: {caller_name: name} )
24
+ end
25
+
26
+ def say(lang, text)
27
+ add(action: :say, args: {lang: lang, text: text})
28
+ end
29
+
30
+ def dial(number)
31
+ add(action: :say, args: {destination: number})
32
+ end
33
+
34
+ def build
35
+ @bfon.to_json
36
+ end
37
+
38
+
39
+ private
40
+
41
+ def add(bfon_action = {})
42
+ @bfon[:seq] = [] unless @bfon.has_key?(:seq)
43
+ @bfon[:seq] << bfon_action
44
+ self
45
+ end
46
+ end
metadata ADDED
@@ -0,0 +1,93 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: bfon_builder
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - hamitturkukaya
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2015-11-17 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '1.9'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.9'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '10.0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '10.0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: json
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '1.8'
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '1.8'
55
+ description: "%q{You can generate bfon objects with simple method calls}"
56
+ email:
57
+ - dev@bulutfon.com
58
+ executables: []
59
+ extensions: []
60
+ extra_rdoc_files: []
61
+ files:
62
+ - ".gitignore"
63
+ - Gemfile
64
+ - README.md
65
+ - Rakefile
66
+ - bfon_builder.gemspec
67
+ - lib/bfon_builder.rb
68
+ - lib/bfon_builder/version.rb
69
+ homepage: https://github.com/bulutfon/ruby-bfon-builder
70
+ licenses:
71
+ - MIT
72
+ metadata: {}
73
+ post_install_message:
74
+ rdoc_options: []
75
+ require_paths:
76
+ - lib
77
+ required_ruby_version: !ruby/object:Gem::Requirement
78
+ requirements:
79
+ - - ">="
80
+ - !ruby/object:Gem::Version
81
+ version: '0'
82
+ required_rubygems_version: !ruby/object:Gem::Requirement
83
+ requirements:
84
+ - - ">="
85
+ - !ruby/object:Gem::Version
86
+ version: '0'
87
+ requirements: []
88
+ rubyforge_project:
89
+ rubygems_version: 2.4.5.1
90
+ signing_key:
91
+ specification_version: 4
92
+ summary: "%q{This is a gem for easy bfon string generator for ruby}"
93
+ test_files: []