wolas_channel 0.1.0 → 0.1.1

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: c8f4ebe2708a9d2083113f4f0013c7d0afaf3693
4
- data.tar.gz: 90712491e1867b08e2f0661963be3c803aef08f1
3
+ metadata.gz: 8f14856471b65c461e0f74f8305a2e0af55bd35d
4
+ data.tar.gz: a06f9887cbd0c3e170650e4b85d0ac05b16044d6
5
5
  SHA512:
6
- metadata.gz: 62ddafe52275d7ba7a1013edcd4df50041a586dd2f7cbff4c723d85dd7197ccb7dfd005bb6fb4b2004f643262f61436d19ea79cd265093471e655341572c994d
7
- data.tar.gz: f2e309aafaf0c587a0fcefd6631c3953970a02ac73bbe767c055dc5ba6529d6e088cfb948f8ed621af45121210daa7ddc24eef89dff98d8149bbafa13c89f890
6
+ metadata.gz: 3c4cfb2ecd0fdb89d32c9b5650267184299aac3e48b562ff0c7fdaffe2921106dcea1a908676d86c0348c930954a19cbbfbd9d78c762ad80477c0487e35302a1
7
+ data.tar.gz: 0f9fff9a385468d4fd99c5b1578de207bc32b95f1d3b0d83f904b97ea933d46ecfc202891aab21cf555c2948121f923cebc9c2246a80b5643fe5e61087025c07
data/README.md CHANGED
@@ -112,7 +112,7 @@ channel.get_channel('78ceb188-0090-4877-af5b-c01f2a222966')
112
112
  The *insert_entity* method allows a tenant to the create a new entry against a channel, as long as they are the owner of the channel to which they are trying to post the entry.
113
113
 
114
114
  ```ruby
115
- args = ('entity_id', 'key', 'value')
115
+ args = ('channel_id', 'insert_object')
116
116
 
117
117
  object = { hello: 'world' }
118
118
  channel.insert_entity('78ceb188-0090-4877-af5b-c01f2a222966', object)
data/lib/connection.rb CHANGED
@@ -1,10 +1,12 @@
1
1
  require 'mysql2'
2
2
  # Establish connection to mysql2
3
3
  class Connection
4
- def open
4
+ def open(database, host, username, password)
5
5
  @connection = Mysql2::Client.new(
6
- :host => '127.0.0.1',
7
- :username => "root",
6
+ :database => database,
7
+ :host => host,
8
+ :username => username,
9
+ :password => password,
8
10
  :connect_timeout => 20
9
11
  )
10
12
  end
@@ -1,3 +1,3 @@
1
1
  class WolasChannel
2
- VERSION = "0.1.0"
2
+ VERSION = "0.1.1"
3
3
  end
data/lib/wolas_channel.rb CHANGED
@@ -13,15 +13,19 @@ end
13
13
  # This class handles mapping the channel items from and to the database
14
14
  class WolasChannel
15
15
  # Initialize a tenant_id when the channel service is instantiated
16
- def initialize(tenant_id)
16
+ def initialize(tenant_id, database, host, username, password)
17
17
  @tenant_id = tenant_id
18
+ @database = database
19
+ @host = host
20
+ @user = username
21
+ @pw = password
18
22
  end
19
23
 
20
24
  # This method allows a tenant to add a channel to their tenancy
21
25
  def add_channel(type = 'Not Specified')
22
26
  begin
23
27
  # Connect to the database
24
- connect = Connection.new.open
28
+ connect = Connection.new.open(@database, @host, @user, @pw)
25
29
  # Generate a UUID for the new channel
26
30
  channel_id = SecureRandom.uuid
27
31
 
@@ -42,7 +46,7 @@ class WolasChannel
42
46
  begin
43
47
  # Connect to the database. Instance variable used to pass the connection to
44
48
  # private methods
45
- @connect = Connection.new.open
49
+ @connect = Connection.new.open(@database, @host, @user, @pw)
46
50
  # Determine if the tenant is able to view this entity based off the
47
51
  # channel and return the type of the entity
48
52
  check = tenant_entity(entity_id)
@@ -64,7 +68,7 @@ class WolasChannel
64
68
  begin
65
69
  # Connect to the database. Instance variable used to pass connection to
66
70
  # private methods
67
- @connect = Connection.new.open
71
+ @connect = Connection.new.open(@database, @host, @user, @pw)
68
72
  # Determine if this channel is valid for the tenant and returns its type
69
73
  type = tenant_channel(channel_id)
70
74
  return nil if type == nil
@@ -95,7 +99,7 @@ class WolasChannel
95
99
  begin
96
100
  # Connect to the database. Instance variable used to pass connection to
97
101
  # private methods
98
- @connect = Connection.new.open
102
+ @connect = Connection.new.open(@database, @host, @user, @pw)
99
103
  # Determine if the tenant has access to the channel requested
100
104
  tenant_channel(channel_id)
101
105
 
@@ -121,7 +125,7 @@ class WolasChannel
121
125
  begin
122
126
  # Connect to the database. Instance variable used to pass connection to
123
127
  # private methods
124
- @connect = Connection.new.open
128
+ @connect = Connection.new.open(@database, @host, @user, @pw)
125
129
  # Determine if the tenant has access to the entity requested
126
130
  check = tenant_entity(entity_id)
127
131
  type = check[0]
Binary file
@@ -20,7 +20,7 @@ Gem::Specification.new do |spec|
20
20
 
21
21
  spec.add_development_dependency 'bundler', '~> 1.8'
22
22
  spec.add_development_dependency 'rake', '~> 10.0'
23
- spec.add_development_dependency 'rspec'
24
- spec.add_development_dependency 'byebug'
25
- spec.add_development_dependency 'mysql2'
23
+ spec.add_development_dependency 'rspec', '~> 3.3.0'
24
+ spec.add_development_dependency 'byebug', '~> 6.0.2'
25
+ spec.add_development_dependency 'mysql2', '~> 0.4.1'
26
26
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: wolas_channel
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - WOLAS
@@ -42,44 +42,44 @@ dependencies:
42
42
  name: rspec
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - ">="
45
+ - - "~>"
46
46
  - !ruby/object:Gem::Version
47
- version: '0'
47
+ version: 3.3.0
48
48
  type: :development
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - ">="
52
+ - - "~>"
53
53
  - !ruby/object:Gem::Version
54
- version: '0'
54
+ version: 3.3.0
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: byebug
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
- - - ">="
59
+ - - "~>"
60
60
  - !ruby/object:Gem::Version
61
- version: '0'
61
+ version: 6.0.2
62
62
  type: :development
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
- - - ">="
66
+ - - "~>"
67
67
  - !ruby/object:Gem::Version
68
- version: '0'
68
+ version: 6.0.2
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: mysql2
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
- - - ">="
73
+ - - "~>"
74
74
  - !ruby/object:Gem::Version
75
- version: '0'
75
+ version: 0.4.1
76
76
  type: :development
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
- - - ">="
80
+ - - "~>"
81
81
  - !ruby/object:Gem::Version
82
- version: '0'
82
+ version: 0.4.1
83
83
  description: Enables key-value storage of channel items (communication, change logs
84
84
  etc)
85
85
  email:
@@ -99,6 +99,7 @@ files:
99
99
  - lib/connection.rb
100
100
  - lib/wolas_channel.rb
101
101
  - lib/wolas_channel/version.rb
102
+ - wolas_channel-0.1.0.gem
102
103
  - wolas_channel.gemspec
103
104
  homepage: https://bitbucket.org/wolas-revolution/srvc-channel
104
105
  licenses: []