rhapsody 0.0.8 → 0.0.9
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,15 +1,15 @@
|
|
|
1
1
|
---
|
|
2
2
|
!binary "U0hBMQ==":
|
|
3
3
|
metadata.gz: !binary |-
|
|
4
|
-
|
|
4
|
+
ZWU1YzAyZDA5NDAzOTlmMmVkNzEzMGYxZWNmZjZmMTE1ZmU2ZWRmMg==
|
|
5
5
|
data.tar.gz: !binary |-
|
|
6
|
-
|
|
6
|
+
M2JkNDUxOTJjYWQ4MGNmZjg2YjgyOTczMTY2YTZkYjJjYjgyYjQ5OQ==
|
|
7
7
|
SHA512:
|
|
8
8
|
metadata.gz: !binary |-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
9
|
+
Y2ZmNGE4MmQzYTcxMTYwYTg0ZmI1YWRlMTQ1ZTM0NmQxNDg0MjVlYWQxNmU4
|
|
10
|
+
NDQ4ZTc0MDBjOGRmZDI1NTQ3ZjNlZWUxY2M3ZDViM2RjNzY5MjdiOWJmMGQw
|
|
11
|
+
MDhhOWFiMTBmMDE1ZDY5N2I0ZGZlMmYyMGVmNDZjZWNkNmI1ODA=
|
|
12
12
|
data.tar.gz: !binary |-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
13
|
+
ZmNiNjc4NGM4ZGQwYmMxZGNhYzI5YzlmYzUyMDBmM2VmMzJhYjI3YWFkZTc4
|
|
14
|
+
OWIyNDljYWIyZTRiYjIxODRhOTBiZTE5NGE1MmE0Mjk0YzQ1NWYzYjA1YjQz
|
|
15
|
+
NzBiNmY2NWRkZmMzZmU2MDkzM2NlMGRjNmJlZGU3NTlhZDQ3Y2Q=
|
|
@@ -1,48 +1,69 @@
|
|
|
1
1
|
class Rhapsody::Member
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
:
|
|
6
|
-
:
|
|
7
|
-
:
|
|
8
|
-
:
|
|
9
|
-
:
|
|
10
|
-
:
|
|
11
|
-
:
|
|
12
|
-
:
|
|
13
|
-
:
|
|
14
|
-
:
|
|
15
|
-
:
|
|
16
|
-
:
|
|
17
|
-
:
|
|
18
|
-
:
|
|
19
|
-
:
|
|
20
|
-
:
|
|
21
|
-
:
|
|
22
|
-
:
|
|
23
|
-
:
|
|
24
|
-
:
|
|
25
|
-
:
|
|
26
|
-
:
|
|
27
|
-
:
|
|
28
|
-
:
|
|
29
|
-
:
|
|
30
|
-
:
|
|
31
|
-
:
|
|
32
|
-
:
|
|
33
|
-
:
|
|
34
|
-
:
|
|
35
|
-
:
|
|
2
|
+
require 'json'
|
|
3
|
+
|
|
4
|
+
ATTR_LIST_HASH = [
|
|
5
|
+
{attribute: :cobrand, type: 'String'},
|
|
6
|
+
{attribute: :cocat, type: 'String'},
|
|
7
|
+
{attribute: :email, type: 'String'},
|
|
8
|
+
{attribute: :logon, type: 'String'},
|
|
9
|
+
{attribute: :first_name, type: 'String'},
|
|
10
|
+
{attribute: :id, type: 'String'},
|
|
11
|
+
{attribute: :last_name, type: 'String'},
|
|
12
|
+
{attribute: :locale, type: 'String'},
|
|
13
|
+
{attribute: :country, type: 'String'},
|
|
14
|
+
{attribute: :is_public, type: 'Boolean'},
|
|
15
|
+
{attribute: :billing_partner_code, type: 'String'},
|
|
16
|
+
{attribute: :create_date, type: 'Integer'},
|
|
17
|
+
{attribute: :is_suspended, type: 'Boolean'},
|
|
18
|
+
{attribute: :tier_code, type: 'String'},
|
|
19
|
+
{attribute: :tier_name, type: 'String'},
|
|
20
|
+
{attribute: :product_code, type: 'String'},
|
|
21
|
+
{attribute: :product_name, type: 'String'},
|
|
22
|
+
{attribute: :expiration_date, type: 'Integer'},
|
|
23
|
+
{attribute: :trial_length_days, type: 'Integer'},
|
|
24
|
+
{attribute: :is_trial, type: 'Boolean'},
|
|
25
|
+
{attribute: :state, type: 'String'},
|
|
26
|
+
{attribute: :can_stream_on_web, type: 'Boolean'},
|
|
27
|
+
{attribute: :can_stream_on_mobile, type: 'Boolean'},
|
|
28
|
+
{attribute: :can_stream_on_home_device, type: 'Boolean'},
|
|
29
|
+
{attribute: :can_stream_on_pc, type: 'Boolean'},
|
|
30
|
+
{attribute: :can_upgrade_streams, type: 'Boolean'},
|
|
31
|
+
{attribute: :max_stream_count, type: 'Integer'},
|
|
32
|
+
{attribute: :is_play_based_tier, type: 'Boolean'},
|
|
33
|
+
{attribute: :is_monthly_play_based_tier, type: 'Boolean'},
|
|
34
|
+
{attribute: :is_one_time_play_based_tier, type: 'Boolean'},
|
|
35
|
+
{attribute: :total_plays, type: 'Integer'},
|
|
36
|
+
{attribute: :plays_remaining, type: 'Integer'}
|
|
36
37
|
]
|
|
37
38
|
|
|
38
|
-
|
|
39
|
+
class << self
|
|
40
|
+
def attr_list_hash_attr
|
|
41
|
+
ATTR_LIST_HASH.map {|hash| hash[:attribute] }
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
# TODO: This needs to be global / base
|
|
45
|
+
def define_attr_accessor(key)
|
|
46
|
+
__send__(:attr_accessor, key)
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
def to_camelcase(key)
|
|
50
|
+
key.to_s.underscore
|
|
51
|
+
end
|
|
52
|
+
end
|
|
39
53
|
|
|
40
54
|
def initialize(options)
|
|
41
55
|
if options
|
|
42
56
|
options.each do |key, value|
|
|
43
|
-
|
|
57
|
+
key = Rhapsody::Member.to_camelcase(key)
|
|
58
|
+
|
|
59
|
+
# Set attr_accessor dynamically
|
|
60
|
+
Rhapsody::Member.define_attr_accessor(key)
|
|
61
|
+
|
|
62
|
+
# Set value for the attribute
|
|
63
|
+
send("#{key}=", value)
|
|
44
64
|
end
|
|
45
65
|
end
|
|
46
66
|
end
|
|
47
67
|
|
|
68
|
+
|
|
48
69
|
end
|
data/lib/rhapsody/version.rb
CHANGED
|
@@ -29,6 +29,38 @@ module AuthenticationHelper
|
|
|
29
29
|
access_token = json_response['access_token']
|
|
30
30
|
end
|
|
31
31
|
|
|
32
|
+
def AuthenticationHelper.get_connected_client
|
|
33
|
+
oauth_path = 'https://api.rhapsody.com/oauth/token'
|
|
34
|
+
yaml = ConfigHelper.load
|
|
35
|
+
config_variables = yaml['config_variables']
|
|
36
|
+
api_key = config_variables['API_KEY']
|
|
37
|
+
api_secret = config_variables['API_SECRET']
|
|
38
|
+
username = config_variables['USERNAME']
|
|
39
|
+
password = config_variables['PASSWORD']
|
|
40
|
+
|
|
41
|
+
connection = Faraday.new(:url => Rhapsody::HOST_URL) do |faraday|
|
|
42
|
+
faraday.request :url_encoded
|
|
43
|
+
faraday.basic_auth(api_key, api_secret)
|
|
44
|
+
faraday.adapter Faraday.default_adapter
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
post_hash = {
|
|
48
|
+
username: username,
|
|
49
|
+
password: password,
|
|
50
|
+
grant_type: 'password'
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
raw_response = connection.post(oauth_path, post_hash)
|
|
54
|
+
json_response = JSON.parse(raw_response.env[:body])
|
|
55
|
+
|
|
56
|
+
client = Rhapsody::ClientsController.new({
|
|
57
|
+
api_key: config_variables['API_KEY'],
|
|
58
|
+
api_secret: config_variables['API_SECRET'],
|
|
59
|
+
access_token: json_response['access_token'],
|
|
60
|
+
refresh_token: json_response['refresh_token']
|
|
61
|
+
})
|
|
62
|
+
end
|
|
63
|
+
|
|
32
64
|
# typical post hash
|
|
33
65
|
def AuthenticationHelper.post_hash
|
|
34
66
|
yaml = ConfigHelper.load
|
|
@@ -65,7 +65,14 @@ describe Rhapsody::ClientsController do
|
|
|
65
65
|
:playsRemaining
|
|
66
66
|
]
|
|
67
67
|
member_attributes.each do |attr|
|
|
68
|
-
expect(member).to respond_to(attr)
|
|
68
|
+
expect(member).to respond_to(attr.to_s.underscore)
|
|
69
69
|
end
|
|
70
70
|
end
|
|
71
|
+
|
|
72
|
+
it '#renew' do
|
|
73
|
+
client_controller = AuthenticationHelper.get_connected_client
|
|
74
|
+
client_controller.renew
|
|
75
|
+
|
|
76
|
+
expect(client_controller.response_status).to eql(200)
|
|
77
|
+
end
|
|
71
78
|
end
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: rhapsody
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.0.
|
|
4
|
+
version: 0.0.9
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Jason Kim
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2014-
|
|
11
|
+
date: 2014-10-06 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: bundler
|