Class: BeyondApi::Session
- Inherits:
-
Object
- Object
- BeyondApi::Session
- Defined in:
- lib/beyond_api/session.rb
Defined Under Namespace
Classes: InvalidUriProtocolError
Instance Attribute Summary collapse
-
#access_token ⇒ Object
Returns the value of attribute access_token.
-
#api_url ⇒ Object
readonly
Returns the value of attribute api_url.
-
#refresh_token ⇒ Object
Returns the value of attribute refresh_token.
Instance Method Summary collapse
- #carts ⇒ Object
- #categories ⇒ Object
- #categories_view ⇒ Object
- #checkout_settings ⇒ Object
- #customer_groups ⇒ Object
- #customers ⇒ Object
-
#initialize(api_url:, access_token: nil, refresh_token: nil) ⇒ Session
constructor
A new instance of Session.
- #newsletter_target ⇒ Object
- #order_settings ⇒ Object
- #orders ⇒ Object
- #payment_method_definitions ⇒ Object
- #payment_methods ⇒ Object
- #pickup_options ⇒ Object
- #product_attribute_definitions ⇒ Object
- #products ⇒ Object
- #products_view ⇒ Object
- #script_tags ⇒ Object
- #shipping_zones ⇒ Object
- #shop ⇒ Object
- #signers ⇒ Object
- #token ⇒ Object
- #users ⇒ Object
- #variations ⇒ Object
- #webhook_subscriptions ⇒ Object
Constructor Details
#initialize(api_url:, access_token: nil, refresh_token: nil) ⇒ Session
Returns a new instance of Session.
35 36 37 38 39 40 41 42 43 |
# File 'lib/beyond_api/session.rb', line 35 def initialize(api_url:, access_token: nil, refresh_token: nil) raise InvalidUriProtocolError, "Invalid URI protocol" unless api_url.start_with? "https://" uri = URI.parse(api_url) @api_url = "#{uri.scheme}://#{uri.host}/api" @access_token = access_token @refresh_token = refresh_token end |
Instance Attribute Details
#access_token ⇒ Object
Returns the value of attribute access_token.
33 34 35 |
# File 'lib/beyond_api/session.rb', line 33 def access_token @access_token end |
#api_url ⇒ Object (readonly)
Returns the value of attribute api_url.
32 33 34 |
# File 'lib/beyond_api/session.rb', line 32 def api_url @api_url end |
#refresh_token ⇒ Object
Returns the value of attribute refresh_token.
33 34 35 |
# File 'lib/beyond_api/session.rb', line 33 def refresh_token @refresh_token end |
Instance Method Details
#carts ⇒ Object
45 46 47 |
# File 'lib/beyond_api/session.rb', line 45 def carts BeyondApi::Carts.new(self) end |
#categories ⇒ Object
53 54 55 |
# File 'lib/beyond_api/session.rb', line 53 def categories BeyondApi::Categories.new(self) end |
#categories_view ⇒ Object
49 50 51 |
# File 'lib/beyond_api/session.rb', line 49 def categories_view BeyondApi::CategoriesView.new(self) end |
#checkout_settings ⇒ Object
57 58 59 |
# File 'lib/beyond_api/session.rb', line 57 def checkout_settings BeyondApi::CheckoutSettings.new(self) end |
#customer_groups ⇒ Object
61 62 63 |
# File 'lib/beyond_api/session.rb', line 61 def customer_groups BeyondApi::CustomerGroups.new(self) end |
#customers ⇒ Object
65 66 67 |
# File 'lib/beyond_api/session.rb', line 65 def customers BeyondApi::Customers.new(self) end |
#newsletter_target ⇒ Object
69 70 71 |
# File 'lib/beyond_api/session.rb', line 69 def BeyondApi::NewsletterTarget.new(self) end |
#order_settings ⇒ Object
73 74 75 |
# File 'lib/beyond_api/session.rb', line 73 def order_settings BeyondApi::OrderSettings.new(self) end |
#orders ⇒ Object
77 78 79 |
# File 'lib/beyond_api/session.rb', line 77 def orders BeyondApi::Orders.new(self) end |
#payment_method_definitions ⇒ Object
81 82 83 |
# File 'lib/beyond_api/session.rb', line 81 def payment_method_definitions BeyondApi::PaymentMethodDefinitions.new(self) end |
#payment_methods ⇒ Object
85 86 87 |
# File 'lib/beyond_api/session.rb', line 85 def payment_methods BeyondApi::PaymentMethods.new(self) end |
#pickup_options ⇒ Object
89 90 91 |
# File 'lib/beyond_api/session.rb', line 89 def BeyondApi::PickupOptions.new(self) end |
#product_attribute_definitions ⇒ Object
93 94 95 |
# File 'lib/beyond_api/session.rb', line 93 def product_attribute_definitions BeyondApi::ProductAttributeDefinitions.new(self) end |
#products ⇒ Object
101 102 103 |
# File 'lib/beyond_api/session.rb', line 101 def products BeyondApi::Products.new(self) end |
#products_view ⇒ Object
97 98 99 |
# File 'lib/beyond_api/session.rb', line 97 def products_view BeyondApi::ProductsView.new(self) end |
#script_tags ⇒ Object
105 106 107 |
# File 'lib/beyond_api/session.rb', line 105 def BeyondApi::ScriptTags.new(self) end |
#shipping_zones ⇒ Object
109 110 111 |
# File 'lib/beyond_api/session.rb', line 109 def shipping_zones BeyondApi::ShippingZones.new(self) end |
#shop ⇒ Object
113 114 115 |
# File 'lib/beyond_api/session.rb', line 113 def shop BeyondApi::Shop.new(self) end |
#signers ⇒ Object
117 118 119 |
# File 'lib/beyond_api/session.rb', line 117 def signers BeyondApi::Signers.new(self) end |
#token ⇒ Object
121 122 123 |
# File 'lib/beyond_api/session.rb', line 121 def token BeyondApi::Token.new(self) end |
#users ⇒ Object
125 126 127 |
# File 'lib/beyond_api/session.rb', line 125 def users BeyondApi::Users.new(self) end |
#variations ⇒ Object
129 130 131 |
# File 'lib/beyond_api/session.rb', line 129 def variations BeyondApi::Variations.new(self) end |
#webhook_subscriptions ⇒ Object
133 134 135 |
# File 'lib/beyond_api/session.rb', line 133 def webhook_subscriptions BeyondApi::WebhookSubscriptions.new(self) end |